WPIntell

Source evidence

PHP 8 Compatibility

SEO Redirection Plugin – 301 Redirect Manager · support · 2022-08-23T16:01:00+00:00

mixedsentiment
highseverity
0.94relevance
6replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 25 rows with source links

20.0% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

20 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
nickiova resolved
Hi 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

Comments

6 shown
Adam Salah 2022-08-23T19:01:00+00:00

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

nickiova 2022-08-23T22:05:00+00:00

Thanks, @adam1318 ! That is good to know! Appreciate the response!

Matthieu 2022-10-10T12:42:00+00:00

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!

osama.esh 2022-10-11T13:09:00+00:00

Thank you for your help and feedback, version updated

Aaron Barraza 2022-12-08T11:00:00+00:00

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

osama.esh 2022-12-08T13:26:00+00:00

hello, thank you @aebs90 for your hard work, fo sure yes, we will publish an update soon