#41121 [Opn->Bgs]: range() function produces an error for values 2147483646 & 2147483647 as low &
ID: 41121
Updated by: iliaa@php.net
Reported By: mahesh dot vemula at in dot ibm dot com
-Status: Open
+Status: Bogus
Bug Type: Compile Failure
Operating System: RHEL 4
PHP Version: 5CVS-2007-04-17 (snap)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The 2147483647 overflows resulting in a negative value directing PHP to
create an array of an enourmous number of elements. To achieve the
desired result you need to pass the parameters are doubles
Ex. var_dump( range(2147483646.0, 2147483647.0) );
Previous Comments:
------------------------------------------------------------------------
[2007-04-17 14:14:06] mahesh dot vemula at in dot ibm dot com
Description:
------------
range() function throws a fatal error message when low = 2147483646,
high = 2147483647 & step is default (i.e 1). These values gives range of
1 step and the values are valid integers.
Environment:
Operating System: RHEL 4
Linux Kernel : Linux 2.6.9
PHP Version: PHP 5.2 (Built on Apr 17, 2007 from snaps.php.net)
PHP Configure Setup: ./configure
I will be attaching a patch for this as soon as possible.
Reproduce code:
---------------
<?php
var_dump( range(2147483646, 2147483647) );
?>
Expected result:
----------------
array(2) {
[0]=>
int(2147483646)
[1]=>
int(2147483647)
}
Actual result:
--------------
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 34 bytes) in %s on line %d
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41121&edit=1
Thread (4 messages)