Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1488431
    Rob Marlbrough
    Guest

    My client using Enfold is on PHP 8.3, after updating Enfold the site died with a fatal error:

    Got error ‘PHP message: PHP Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /var/www/vhosts/domain.com/httpdocs/wp-content/themes/enfold/framework/php/function-set-avia-backend.php:1012

    That line is:
    $filecontent = fread( $handle, $fsize );

    The error happens because in PHP 8.3, fread() now throws a ValueError if you pass a length of 0 or negative. In PHP 8.2 it would just return an empty string silently.

    It should be changed to:
    $filecontent = $fsize > 0 ? fread($handle, $fsize) : ”;

    For now I just switched the client to PHP 8.2, and that was a quick fix. Please patch it so that others using PHP 8.3 don’t break their sites.

    #1488435

    Hey Rob,

    We are running PHP 8.4 on several test installations without any problems, are you sure that you are running the latest version of the theme?

    Best regards,
    Rikard

    #1488457

    Yes it was the latest… but it also is not happening on other sites, so it may be conditional on what that function is doing, if the length of a file is zero it will error, but what causes it to be zero?

    The error will occur in 8.3 only if the length is zero or null, I guess.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.