[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
Sun Apr 10 14:32:11 UTC 2016


#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
Component:  Bootstrap/Load                       |  Release
 Severity:  normal                               |     Version:  3.2
 Keywords:  has-patch dev-feedback has-unit-     |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by jrf):

 Added a check for whether the memory limit can actually be changed as per
 @mensmaximus suggestion.
 This check is applied to the setting of both the `WP_MEMORY_LIMIT`
 constant as well as the `WP_MAX_MEMORY_LIMIT` constant.

 This makes the value of these constants more realistic and prevents trying
 to change the memory limit if it cannot be changed.
 The actual end result of the attempt to raise the memory is not affected
 by this, so it's more a cosmetic change than anything else.

 The check does necessitate yet another new function to be added to the
 `load.php` file.

 Other than that, the new patch (v7):
 * has been rebased against the current master.
 * adds unit tests for both of the new functions in `load.php`. As there
 was no test file for `load.php` yet (AFAICS), I've created one.
 * contains a minor improvement in how the `wp_php_ini_bytes_to_int()`
 function deals with large values on 32-bit systems. Please note: This
 change does prevent the memory limit being raised to > 2G on 32-bit
 systems, however it prevents the value being disregarded completely.
 * presumes that this patch will not make it into 4.5 (upped the @since
 tags to 4.6.0).
 * adds @since changelog tags to the filters.
 * fixes a typo in the documentation.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32075#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list