[Bug?] UpdraftPlus breaks Backend – Call to undefined function disk_free_space()
-
Hello!
I got a somewhat odd problem with 3 websites on the same server / webhoster. Until the 8th December, the backups worked just fine. Starting on the 9th, the backups on all 3 websites started failing, and the backends were inaccessible.
Error details ============== An error of type E_ERROR was caused in line 1251 of the file /home/www/domain.com/wp-content/plugins/updraftplus/admin.php. Error message: Uncaught Error: Call to undefined function disk_free_space() in /home/www/domain.com/wp-content/plugins/updraftplus/admin.php:1251 Stack trace: #0 /home/www/domain.com/wp-content/plugins/updraftplus/admin.php(281): UpdraftPlus_Admin->disk_space_check(36700160) #1 /home/www/domain.com/wp-content/plugins/updraftplus/admin.php(580): UpdraftPlus_Admin->setup_all_admin_notices_global('s3generic') #2 /home/www/domain.com/wp-content/plugins/updraftplus/admin.php(38): UpdraftPlus_Admin->admin_init() #3 /home/www/domain.com/wp-content/plugins/updraftplus/admin.php(8): UpdraftPlus_Admin->__construct() #4 /home/www/domain.com/wp-content/plugins/updraftplus/updraftplus.php(104): include_once('/home/www/domai...') #5 /home/www/domain.com/wp-content/plugins/updraftplus/class-updraftplus.php(508): updraft_try_include_file('admin.php', 'include_once') #6 /home/www/domain.com/wp-includes/class-wp-hook.php(324): UpdraftPlus->admin_menu('') #7 /home/www/domain.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #8 /home/www/domain.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #9 /home/www/domain.com/wp-admin/includes/menu.php(161): do_action('admin_menu', '') #10 /home/www/domain.com/wp-admin/menu.php(417): require_once('/home/www/domai...') #11 /home/www/domain.com/wp-admin/admin.php(158): require('/home/www/domai...') #12 /home/www/domain.com/wp-admin/plugins.php(10): require_once('/home/www/domai...') #13 {main} thrown
No updates of WordPress or any plugins were done in the past few weeks. Disabling UpdraftPlus allows me to access the backends again.
As I’ve not seen this on any of the other sites I support, I contacted the webhoster. As per their statement, no changes were done on the server side and I was recommended to switch to PHP 8.1 or 8.2 as this will “fix” the issue. But one site is still running a legacy plugin I’m stilling trying to replace, and I’m not ready to so right now. The hoster only allows changing the PHP version globally and not per domain. I was also told that the PHP function disk_free_space is already disabled for “years” and can’t be the cause of the issue.
I’ve checked the UpdraftPlus logs and I see that something certainly changed between the 8th and the 9th
Last successful backup on the 8th
0000.000 (0) Opened log file at time: Fri, 08 Dec 2023 13:58:15 +0000 on https://www.domain.com 0000.003 (0) UpdraftPlus WordPress backup plugin (https://updraftplus.com): 1.23.13 WP: 6.4.2 PHP: 8.0.30 (apache2handler, Linux host.domain.com 5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64) MySQL: 10.10.5-MariaDB-1:10.10.5+maria~deb11 (max packet size=1073741824) WPLANG: de_DE_formal Server: Apache safe_mode: 0 max_execution_time: 900 memory_limit: 1024M (used: 169.5M | 184M) multisite: N openssl: OpenSSL 1.1.1n 15 Mar 2022 mcrypt: N LANG: C ZipArchive::addFile: Y
Next backup on the 9th failed
0000.005 (0) Opened log file at time: Sat, 09 Dec 2023 13:53:30 +0000 on https://www.domain.com 0000.009 (0) UpdraftPlus WordPress backup plugin (https://updraftplus.com): 1.23.13 WP: 6.4.2 PHP: 8.0.30 (apache2handler, Linux host.domain.com 5.10.0-23-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64) MySQL: 10.10.5-MariaDB-1:10.10.5+maria~deb11 (max packet size=1073741824) WPLANG: de_DE_formal Server: Apache safe_mode: 0 max_execution_time: 900 memory_limit: 1024M (used: 169.1M | 180M) multisite: N openssl: OpenSSL 1.1.1n 15 Mar 2022 mcrypt: Y LANG: C ZipArchive::addFile: Y
As you can see, mcrypt is suddenly available. Or could this be caused by something else? All previous backup logs show mcrypt as N.
The main question here for me is this: Is there anything else that could cause this issue? From what I see from the source code of UpdraftPlus, you already handle if the function is not available. From admin.php:
private function disk_space_check($space) { // Allow checking by some other means (user request) if (null !== ($filtered_result = apply_filters('updraftplus_disk_space_check', null, $space))) return $filtered_result; global $updraftplus; $updraft_dir = $updraftplus->backups_dir_location(); $disk_free_space = function_exists('disk_free_space') ? @disk_free_space($updraft_dir) : false;// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Silenced to suppress errors that may arise because of the function. if (false == $disk_free_space) return -1; return ($disk_free_space > $space) ? true : false; }
So technically we shouldn’t run into this issue with UpdraftPlus?
Let me know if you need any other information to look into this.
- The topic ‘[Bug?] UpdraftPlus breaks Backend – Call to undefined function disk_free_space()’ is closed to new replies.