Make WordPress Core

Opened 8 months ago

Closed 7 months ago

Last modified 5 months ago

#59687 closed enhancement (invalid)

get_test_available_updates_disk_space() does not handle an $available_space of NULL correctly

Reported by: larrydaniele's profile Larry.Daniele Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.3.2
Component: Site Health Keywords:
Focuses: Cc:

Description

This is a follow-up to #59116.

On the client sites I have hosted on WP Engine, get_test_available_updates_disk_space() (in class-wp-site-health.php) gets an $available_space value of NULL in the code:

		$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR . '/upgrade/' ) : false;

The NULL value does NOT get processed in the "if" statement (as it should):

if ( false === $available_space ) 

Instead the subsequent:

elseif ( $available_space < 20 * MB_IN_BYTES )

test is true and Site Health reports:

'Available disk space is critically low, less than 20 MB available. Proceed with caution, updates may fail.'

when that is not the case.

It seems that the first "if" clause should be:

if ( is_null( $available_space ) || (false === $available_space ) )

I've tried that code and it works (reducing the result from "critical" to "recommended").

Change History (6)

#1 @SergeyBiryukov
8 months ago

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Just to clarify, how can $available_space get a null value here? As per the PHP manual, disk_free_space() can only return float or false.

Unless I'm missing something, the only way to get null would be to disable the function and then redeclare it (which is possible in PHP 8.0+), and return null instead of false, which seems like a wrong thing to do on the host's part.

If the function is simply disabled and not redeclared, the function_exists() check should return false, and $available_space would also be false.

The steps to reproduce the issue would be helpful to move the ticket forward.

Something similar came up before in #56010, also on WP Engine, where they redeclared apache_mod_loaded() to return null instead of an empty array. That was subsequently corrected as noted in comment:2:ticket:56010, so maybe they should correct this too by returning false instead of null, in accordance with the PHP manual.

Last edited 8 months ago by SergeyBiryukov (previous) (diff)

#2 @Larry.Daniele
8 months ago

  • Type changed from defect (bug) to enhancement

Thanks, Sergey. I looked into this further and see this on the WP Engine Platform Settings page at https://wpengine.com/support/platform-settings/ :


Disabled Functions and Modules

Our system administrators have already pre-configured server settings to best suit the needs of the majority of our clients. Some functions cannot be modified from site to site or in the php.ini file as they are configured at a server level.

Here are some functions that have been disabled and therefore are not able to be altered:

...
disk_free_space


I will direct WP Engine support to this ticket for further explanation and investigation. But it would appear that this is not directly a WordPress problem. So protecting against it would be more of an enhancement than a bug fix.

Last edited 8 months ago by Larry.Daniele (previous) (diff)

#3 @Larry.Daniele
8 months ago

This is the response I got from WP Engine this morning:

I see you are getting the following warning on the site: " Available disk space is critically low, less than 20 MB available. Proceed with caution, updates may fail. "

The warning in Site Health on a site is actually something that's generated by WordPress. It is not synced to your environment properly and can be safely ignored. There was a change that WordPress made to the coding of the tool that pulls Disk Space so that output is vastly inaccurate. It may or may not change at some point but that would be something WordPress has to fix. This is a bug in WordPress itself - it should be sorted in the latest update.

I do not know if there is a specific Trac issue related to what WP Engine is reporting. But if so, it would also relate to this issue.

#4 @Larry.Daniele
8 months ago

Here is an update from WP Engine:


Christopher Whyte October 30, 2023 22:47

Hey Larry,

Thanks for your patience with this!

There is a Trac ticket we were following, which is:
https://core.trac.wordpress.org/ticket/59116

Please let me know if you have any questions or concerns!

Chris W, Technical Support Specialist

WP Engine, Inc.


The Trac ticket they reference (59116) is marked as "closed defect (bug) (fixed)". However, after installing WordPress 6.4 on two different WP Engine sites (in separate accounts), I'm still seeing this problem.

#5 @Larry.Daniele
7 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Here another response from WP Engine when I said this problem still exists on their servers:

I wanted to reach out to provide some clarity regarding a recent notification you are seeing in the WordPress dashboard under Tools > Site Health, stating: "Available disk space is critically low, less than 20 MB available."

I wanted to let you know that this is a known issue resulting from a specific configuration on our platform. This configuration limits WordPress's ability to accurately display disk space information for our server and account type.

WP Engine will be working on a resolution. However, we do not have a definitive timeframe for when it will be resolved. Importantly, we can assure you that this error message does not negatively impact your website's performance, security, or functionality.

We apologize for any confusion or concern this may be causing and appreciate your understanding.

Given the above reply, it seems like WP Engine customers will just have to live with this until they fix it. And this is not a WordPress issue, so I'm marking it as "Resolve: Invalid".

#6 @swissspidy
5 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.