Conversation
supportHi there, Is the plugin PHP 8 compatible? We tried enabling PHP 8 on a site using this plugin but caused a critical error when signing in so reverted back to PHP 7.4 which cleared up the issues. See error message: https://gyazo.com/d61202732939426f6dfc658dcd6f37e8 Thanks! The page I need help with: [ log in to see the link]
Hello, @nickiova Thank you for using our plugin and we appreciate this. Actually, PHP 8 is not stable so far and it has a lot of compatibility issues. So, we suggest using PHP 7.4 until they push a clean PHP version. Thank you and have a nice day. Regards
Thanks, @adam1318 ! That is good to know! Appreciate the response!
Hi there, quick fix attached: just check whether fopen is not returning false in case. --- seo-redirection.org.php 2022-10-10 14:37:51.936208538 +0200 +++ seo-redirection.php 2022-10-10 14:41:10.907284467 +0200 @@ -238,11 +238,13 @@ if(is_readable($file)) { $f = @fopen( $file, 'r+' ); - $filestr = @fread($f , filesize($file)); - if (strpos($filestr , $marker_name) === false) - { - insert_with_markers( $file, $marker_name, $content ); - } + if ($f !== false) { + $filestr = @fread($f , filesize($file)); + if (strpos($filestr , $marker_name) === false) + { + insert_with_markers( $file, $marker_name, $content ); + } + } }else{ echo $file.' is not readable!'; } Cheers!
Thank you for your help and feedback, version updated
Hello! The error is still in the plugin. The fix from @theschappy is correct, but it was wrongly implemented. If you see carefully, at the beggining of the lines he has some – (meaning this line should be removed) and + (meaning that line should be added). So, the intention was to replace this: $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } with this: if ($f !== false) { $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } } Or in simple words, wrap the original code inside the if ($f !== false) { } conditional. @osamaesh Is it possible to make this change public? Because what was implemented was to duplicate the code lol: $f = @fopen( $file, 'r+' ); $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } if ($f !== false) { $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } } And the problem with duplicating the code, is that before the validation, the fread() is called, and on the scenarios where $f is false, that causes the php fatal error. Thank you all! This reply was modified 3 years, 6 months ago by Aaron Barraza . Reason: Added additional information
hello, thank you @aebs90 for your hard work, fo sure yes, we will publish an update soon
Hello, @nickiova Thank you for using our plugin and we appreciate this. Actually, PHP 8 is not stable so far and it has a lot of compatibility issues. So, we suggest using PHP 7.4 until they push a clean PHP version. Thank you and have a nice day. Regards
Thanks, @adam1318 ! That is good to know! Appreciate the response!
Hi there, quick fix attached: just check whether fopen is not returning false in case. --- seo-redirection.org.php 2022-10-10 14:37:51.936208538 +0200 +++ seo-redirection.php 2022-10-10 14:41:10.907284467 +0200 @@ -238,11 +238,13 @@ if(is_readable($file)) { $f = @fopen( $file, 'r+' ); - $filestr = @fread($f , filesize($file)); - if (strpos($filestr , $marker_name) === false) - { - insert_with_markers( $file, $marker_name, $content ); - } + if ($f !== false) { + $filestr = @fread($f , filesize($file)); + if (strpos($filestr , $marker_name) === false) + { + insert_with_markers( $file, $marker_name, $content ); + } + } }else{ echo $file.' is not readable!'; } Cheers!
Thank you for your help and feedback, version updated
Hello! The error is still in the plugin. The fix from @theschappy is correct, but it was wrongly implemented. If you see carefully, at the beggining of the lines he has some – (meaning this line should be removed) and + (meaning that line should be added). So, the intention was to replace this: $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } with this: if ($f !== false) { $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } } Or in simple words, wrap the original code inside the if ($f !== false) { } conditional. @osamaesh Is it possible to make this change public? Because what was implemented was to duplicate the code lol: $f = @fopen( $file, 'r+' ); $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } if ($f !== false) { $filestr = @fread($f , filesize($file)); if (strpos($filestr , $marker_name) === false) { insert_with_markers( $file, $marker_name, $content ); } } And the problem with duplicating the code, is that before the validation, the fread() is called, and on the scenarios where $f is false, that causes the php fatal error. Thank you all! This reply was modified 3 years, 6 months ago by Aaron Barraza . Reason: Added additional information
hello, thank you @aebs90 for your hard work, fo sure yes, we will publish an update soon