[wp-trac] [WordPress Trac] #32075: Only set WP_MAX_MEMORY_LIMIT by default when its greater than memory_limit
WordPress Trac
noreply at wordpress.org
Thu Dec 10 09:56:22 UTC 2015
#32075: Only set WP_MAX_MEMORY_LIMIT by default when its greater than memory_limit
------------------------------------+-----------------------------
Reporter: danielbachhuber | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Bootstrap/Load | Version: 3.2
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+-----------------------------
Comment (by jrf):
Ok, improved patch uploaded.
While working on it, I also found a bug in the setting of the 'normal'
memory limit within `wp_initial_constants()`.
Here the conversion only accounted for shorthand byte setting using `M` or
`G`, but did not account for the possibility of the value having been set
as a byte integer (or potentially as `K`).
The new patch also fixes that.
Other notes:
* Removed `function_exists( 'memory_get_usage' )` for setting the 'normal'
memory limit. This is no longer needed since PHP 5.2.1 and as that's below
the WP minimum requirement, no longer needed here.
* Verifies that the new max limit is not below the current limit which
could happen if a plugin would have changed the memory limit.
* Added documentation for the filter and references to where the
documentation can be found.
* The `wp_php_ini_bytes_to_int()` unfortunately has to be added to the
`wp-includes/load.php` file as it has to be available *before* the default
constants are set in `wp_initial_constants()` which is done before `wp-
includes/functions.php` is loaded.
* The patch does *not* use the new WP 4.4 constants for the byte
conversion as the `wp_php_ini_bytes_to_int()` function is created before
they are available.
* Added a minimal test case for phpunit. A more extensive test case would
be desirable, however this can not be done as the test suite uses `-1` for
`WP_MAX_MEMORY_LIMIT` which will effectively bypass the negotiations which
we need to test.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32075#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list