• Line 85 in all-404-redirect-to-homepage.php throws uncaught PHP TypeError exception on PHP 8.1 causing server 500 error/crashes

    These two lines:
    $f = @fopen( $file, ‘r+’ );
    $filestr = @fread($f , filesize($file));

    If fopen() returns false, $f becomes false, which throws TypeError on the next line even though the error suppression operator “@” is used.

    Note that this is probably specific to PHP 8 since it’s more strict about error handling.

  • The topic ‘HTTP 500 server errors on PHP 8.1’ is closed to new replies.