[wp-trac] [WordPress Trac] #59687: get_test_available_updates_disk_space() does not handle an $available_space of NULL correctly
WordPress Trac
noreply at wordpress.org
Fri Oct 20 11:56:42 UTC 2023
#59687: get_test_available_updates_disk_space() does not handle an $available_space
of NULL correctly
---------------------------+------------------------------
Reporter: Larry.Daniele | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Site Health | Version: 6.3.2
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Comment (by SergeyBiryukov):
Hi there, thanks for the ticket!
Just to clarify, how can `$available_space` get a `null` value here? As
per the PHP manual, [https://www.php.net/manual/en/function.disk-free-
space.php 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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59687#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list