Opened 18 months ago
Closed 18 months ago
#59116 closed defect (bug) (fixed)
Integer Casting Error in WP_Site_Health::get_test_available_updates_disk_space() wordpress
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.3.1 | Priority: | normal |
Severity: | normal | Version: | 6.3 |
Component: | Site Health | Keywords: | has-patch fixed-major dev-reviewed commit |
Focuses: | Cc: |
Description
In WP_Site_Health::get_test_available_updates_disk_space() when one has too much free space the variable $available_space becomes negative and so the condition $available_space < 20 * MB_IN_BYTES is incorrectly triggered and reports on the Site Health page that there is not enough free space. A fix for now is to go to wp-admin/includes/class-wp-site-health.php and on line 1947 change ? (int) $available_space to ? $available_space
Attachments (2)
Change History (12)
#3
@
18 months ago
- Milestone changed from Awaiting Review to 6.3.1
- Owner set to SergeyBiryukov
- Status changed from new to accepted
#4
@
18 months ago
The patch checks the maximum possible int value, and if the available space is larger than this, it is simply set to the maximum value (because that is enough and it doesn't matter how large it is exactly).
#5
@
18 months ago
- Keywords has-patch added; needs-patch removed
Thanks for the patch!
I think we can avoid the type casting altogether and optimize the logic a bit to reduce the number of checks in certain scenarios, e.g. skip further checks if $available_space
is false. See 59116.2.diff.
#7
@
18 months ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for 6.3.1 consideration.
Proposal: Should we check if the $available_space is 0 or not, and then make it 0, so that the negative value isn't passed through the test?