Crash under PHP >= 8.0 when disk_free_space() is not available
-
In many shared hosting environments the PHP function disk_free_space() is disabled. Therefore functions/interface.php:496 thus contains the construct
function disk_space_low( $backup_size = false ) { $disk_space = @disk_free_space( Path::get_path() ); if ( ! $disk_space ) { return false; }
[…]
Under PHP <= 7 the “@” in
@disk_free_space( Path::get_path() );
causes disk_space_low() to return False whenever disk_free_space() is not available.With PHP 8.0 the behavior of “@” however has changed https://www.php.net/manual/en/language.operators.errorcontrol.php#112900
For me this makes the WordPress admin panel inaccessible when BackupWordpress is installed and the PHP version of the web server is set to PHP 8.0.25 because I get the error:
An error of type E_ERROR was caused in line 498 of the file /home/www/wordpress/wp-content/plugins/backupwordpress/functions/interface.php. Error message: Uncaught Error: Call to undefined function HM\BackUpWordPress\disk_free_space() in /home/www/wordpress/wp-content/plugins/backupwordpress/functions/interface.php:498 Stack trace: #0 /home/www/wordpress/wp-content/plugins/backupwordpress/functions/interface.php(242): HM\BackUpWordPress\disk_space_low() #1 /home/www/wordpress/wp-includes/class-wp-hook.php(308): HM\BackUpWordPress\set_server_config_notices('') #2 /home/www/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #3 /home/www/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /home/www/wordpress/wp-admin/admin-ajax.php(45): do_action('admin_init') #5 {main} thrown
With PHP 7.4.33 everything works normally.
Would be great to get this fixed! Thanks!
- The topic ‘Crash under PHP >= 8.0 when disk_free_space() is not available’ is closed to new replies.