[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 01:46:30 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         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 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").

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59687>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list