Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Adam Salah

    (@adam1318)

    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

    Thread Starter nickiova

    (@nickiova)

    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!

    Plugin Author osama.esh

    (@osamaesh)

    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 1 year, 11 months ago by Aaron Barraza. Reason: Added additional information
    Plugin Author osama.esh

    (@osamaesh)

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP 8 Compatibility’ is closed to new replies.