mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
4de6175227
r49212 greatly improved the performance of `get_dirsize()`, but also changed the structure of the data stored in the `dirsize_cache` transient. It stored relative paths instead of absolute ones, and also removed the unnecessary `size` array. That difference in data structures led to a fatal error in the following environment: * PHP 8 * Multisite * A custom `WP_CONTENT_DIR` which is not a child of WP's `ABSPATH` folder (e.g., [https://roots.io/bedrock/ Bedrock]) * The `upload_space_check_disabled` option set to `0` After upgrading to WP 5.6, the `dirsize_cache` transient still had data in the old format. When `wp-admin.php/index.php` was visited, `get_space_used()` received an `array` instead of an `int`, and tried to divide it by another `int`. PHP 7 would silently cast the arguments to match data types, but [https://wiki.php.net/rfc/arithmetic_operator_type_checks PHP 8 throws a fatal error]: `Uncaught TypeError: Unsupported operand types: array / int` `recurse_dirsize()` was using `ABSPATH` to convert the absolute paths to relative ones, but some upload locations are not located under `ABSPATH`. In those cases, `$directory` and `$cache_path` were identical, and that triggered the early return of the old `array`, instead of the expected `int`. In order to avoid that, this commit restores the absolute paths, but without the `size` array. It also adds a type check when returning cached values. Using absolute paths without `size` has the result of overwriting the old data, so that it matches the new format. The type check and upgrade routine are additional safety measures. Props peterwilsoncc, janthiel, helen, hellofromtonya, francina, pbiron. Fixes #51913. See #19879. Built from https://develop.svn.wordpress.org/trunk@49744 git-svn-id: http://core.svn.wordpress.org/trunk@49467 1a063a9b-81f0-0310-95a4-ce76da25c4cd |
||
---|---|---|
.. | ||
css | ||
images | ||
includes | ||
js | ||
maint | ||
network | ||
user | ||
about.php | ||
admin-ajax.php | ||
admin-footer.php | ||
admin-functions.php | ||
admin-header.php | ||
admin-post.php | ||
admin.php | ||
async-upload.php | ||
authorize-application.php | ||
comment.php | ||
credits.php | ||
custom-background.php | ||
custom-header.php | ||
customize.php | ||
edit-comments.php | ||
edit-form-advanced.php | ||
edit-form-blocks.php | ||
edit-form-comment.php | ||
edit-link-form.php | ||
edit-tag-form.php | ||
edit-tags.php | ||
edit.php | ||
erase-personal-data.php | ||
export-personal-data.php | ||
export.php | ||
freedoms.php | ||
import.php | ||
index.php | ||
install-helper.php | ||
install.php | ||
link-add.php | ||
link-manager.php | ||
link-parse-opml.php | ||
link.php | ||
load-scripts.php | ||
load-styles.php | ||
media-new.php | ||
media-upload.php | ||
media.php | ||
menu-header.php | ||
menu.php | ||
moderation.php | ||
ms-admin.php | ||
ms-delete-site.php | ||
ms-edit.php | ||
ms-options.php | ||
ms-sites.php | ||
ms-themes.php | ||
ms-upgrade-network.php | ||
ms-users.php | ||
my-sites.php | ||
nav-menus.php | ||
network.php | ||
options-discussion.php | ||
options-general.php | ||
options-head.php | ||
options-media.php | ||
options-permalink.php | ||
options-privacy.php | ||
options-reading.php | ||
options-writing.php | ||
options.php | ||
plugin-editor.php | ||
plugin-install.php | ||
plugins.php | ||
post-new.php | ||
post.php | ||
press-this.php | ||
privacy-policy-guide.php | ||
privacy.php | ||
profile.php | ||
revision.php | ||
setup-config.php | ||
site-health-info.php | ||
site-health.php | ||
term.php | ||
theme-editor.php | ||
theme-install.php | ||
themes.php | ||
tools.php | ||
update-core.php | ||
update.php | ||
upgrade-functions.php | ||
upgrade.php | ||
upload.php | ||
user-edit.php | ||
user-new.php | ||
users.php | ||
widgets.php |