[wp-trac] [WordPress Trac] #14889: Memory Comparison Broken / WordPress Memory Limit

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 8 13:14:08 UTC 2011


#14889: Memory Comparison Broken / WordPress Memory Limit
-----------------------------------------------+---------------------------
 Reporter:  hakre                              |       Owner:
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  Future
Component:  General                            |  Release
 Severity:  normal                             |     Version:  3.0
 Keywords:  has-patch 3.2-early needs-testing  |  Resolution:
-----------------------------------------------+---------------------------

Comment (by hakre):

 I was looking into int size based on system:

 {{{
 32bit: 2 147 483 647
 64bit: 9 223 372 036 854 775 807

 2g: 2 147 483 648
 1g: 1 073 741 824
 1m: 1 048 576
 1k: 1 024
 1b: 1
 }}}

 A memory value of 2g will trigger the
 [http://php.net/manual/en/reserved.constants.php PHP_INT_MAX] for signed
 integers on 32bit systems. So if you can add that value (2147483648) for
 tests with memory settings, I think that would be good to prevent
 triggering this issue.

 The comparison function should successfully work on 2147483648 as well as
 on 4294967296 on 32 bit systems (2g and 4g in bytes). With integer
 overflow, 2147483648 in error can be 2147483647 or -2147483648, 4g can be
 2147483647 or 0 bytes if the error occurs (cap @ PHP_MAX_INT)

 See [http://php.net/manual/en/function.intval.php intval()],
 [http://php.net/manual/en/language.types.integer.php PHP integers].

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14889#comment:29>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list