Site Health: Clarify the recommendation in file uploads test when `post_max_size` is defined as `0`.
This adds a more descriptive text in scenarios where `post_max_size` and `upload_max_filesize` differ, and `post_max_size` is set to a value of `0`. In some scenarios, PHP may read `0` as a literal zero size, and not as unlimited, which it also means in other scenarios. See https://www.php.net/manual/en/ini.core.php#ini.post-max-size for details, as PHP 5.3.4 introduced this behavior for literal zero interpretation when the content type of a request is `application/x-www-form-urlencoded` or is not registered with PHP. Props Clorith, pixolin, helen, ratneshk. Fixes #51466. Built from https://develop.svn.wordpress.org/trunk@50263 git-svn-id: http://core.svn.wordpress.org/trunk@49908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
98b855ed94
commit
ea2ff553e9
|
@ -2177,6 +2177,18 @@ class WP_Site_Health {
|
|||
'upload_max_filesize'
|
||||
);
|
||||
$result['status'] = 'recommended';
|
||||
|
||||
if ( 0 === wp_convert_hr_to_bytes( $post_max_size ) ) {
|
||||
$result['description'] = sprintf(
|
||||
'<p>%s</p>',
|
||||
sprintf(
|
||||
/* translators: 1: post_max_size, 2: upload_max_filesize */
|
||||
__( 'The setting for %1$s is currently configured as 0, this could cause some problems when trying to upload files through plugin or theme features that rely on various upload methods. It is recommended to configure this setting to a fixed value, ideally matching the value of %2$s, as some upload methods read the value 0 as either unlimited, or disabled.' ),
|
||||
'<code>post_max_size</code>',
|
||||
'<code>upload_max_filesize</code>'
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$result['description'] = sprintf(
|
||||
'<p>%s</p>',
|
||||
sprintf(
|
||||
|
@ -2186,6 +2198,8 @@ class WP_Site_Health {
|
|||
'<code>upload_max_filesize</code>'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.7-beta1-50262';
|
||||
$wp_version = '5.7-beta1-50263';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue