Support » Plugin: IP2Location Redirection » Bug found with From URL redirection (and solved)

  • At first, thanks for creating this plugin. Today I found a small bug that can be solved with just one line in the ip2location-redirection.php file.

    In our case when an image doesn’t exists the user gets the 404 page of WordPress. We configured a ruleset in the ip2location-redirection plugin with a custom “from url”.

    When the code is searching for matches it’s looping all the rules. On line 955 you’re exploding the $page_from and mapping the values to a $type and $id variable. But when you’re using a custom “from url” the value of the $page_from url is “url”. Exploding this on “-“. will give you a value of “NULL” (since there is no dash in the string of course).

    On line 957 you’re checking if the value of the $id is equal to get_the_ID(). Because we’re opening a URL that doesn’t exist get_the_ID() return “false”. Which equal the “NULL” on the not strict operator (==).

    So I suggest to add above line 955 one of the following lines:

    if (in_array($page_from, ['any', 'home', 'url', 'domain'])) continue;

    if (is_404()) continue;

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug found with From URL redirection (and solved)’ is closed to new replies.