• Hello there,
    There is a small bug during the importation from a CSV file that set a plain source URL as a regex url.
    I found the bug and here is the fix:

    In file “models/redirect.php” on line 179 change :

    $regex = ( isset( $details['regex'] ) && $details['regex'] !== false ) ? 1 : 0;

    by

    $regex = ( isset( $details['regex'] ) && ((bool)$details['regex']) !== false ) ? 1 : 0;

    The type of $details['regex'] don’t match false as it is an int and not a boolean.

    Hope this will help others and be fixed in next releases.
    Thanks

    https://www.ads-software.com/plugins/redirection/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thanks!

    @kuuak

    That would be great to post as an issue on

    https://github.com/johngodley/redirection/issues

    Along with your fix.

    Thanks – works perfectly ??

    In case the developer is looking at this, the issue relates to lines 148 & 149 in /modoles/redirection.php:

    $details = array_map( 'trim', $details );
    $details = array_map( 'stripslashes', $details );

    Those two lines assume that all values in the $details array are strings which isn’t the case. If you look at /filio/csv.php it is returned as true/false from the is_regex() function.

    The resolution above is correct as it needs to be cast back to a boolean in order for the check to work.

    Thanks for posting this fix!

    gazmcj

    (@gazmcj)

    I have replaced the code in models/redirect.php. It now does not mark all imported URLs as regex anymore – it marks them all as not regex. If there is a column in the CSV titled “regex” with a 1 in it should it not import that row as a regex item?

    Using Version 2.4.5 of plugin (though it says the regex bug is fixed) and WordPress 4.6.1

    • This reply was modified 8 years ago by gazmcj.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Import: Regex value not correctly set’ is closed to new replies.