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