[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
Fri Jul 8 04:48:45 UTC 2016


#32075: Only set WP_MAX_MEMORY_LIMIT by default when its greater than memory_limit
---------------------------------------------+-----------------------
 Reporter:  danielbachhuber                  |       Owner:  ocean90
     Type:  defect (bug)                     |      Status:  accepted
 Priority:  normal                           |   Milestone:  4.6
Component:  Bootstrap/Load                   |     Version:  3.2
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-----------------------

Comment (by jrf):

 @ocean90 @swissspidy Thanks for working with me on this.

 I've had a good look at the latest iterations.

 * Generally: looks good.
 * Very good catch on the `wp_convert_hr_to_bytes()` function ! Completely
 missed that one (and I did actually search for something like it).
 However, the docblock of the `wp_convert_hr_to_bytes()` function is less
 informative than the new docblock was, so I think it would be good to keep
 some of the documentation improvements.
 * As the BYTE constant definitions in `default-constants.php` have been
 moved up to before the first use of `wp_convert_hr_to_bytes()`, that
 function can now use the constant `KB_IN_BYTES`.
 * Personally, I find that the readability of the code had decreased in the
 few places in the patch where a conditional setting a value to be returned
 was replaced by having the condition in the return statement. This does
 not make the code faster and can more easily lead to bugs.
 * The `256 * MB_IN_BYTES` is an unnecessary calculation, the end value
 will never change, so it should be a static value. If this change was made
 for clarity a `// = 256Mb` comment would be more appropriate.

 Let me know which points you consider valid and I'll happily update the
 patch later today.

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


More information about the wp-trac mailing list