ID: 47854 Updated by: j...@php.net Reported By: disas at mail dot ru -Status: Open +Status: Verified Bug Type: Strings related Operating System: * -PHP Version: 5.2.9 +PHP Version: 5.*, 6CVS (2009-04-01) New Comment:
Very strange results with HEAD/PHP_5_3 too: # build/php_6/sapi/cli/php -n -dmemory_limit=2G -r 'var_dump(explode(" "," 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ", -1e99));' Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 18446744073383068122 bytes) in Command line code on line 1 # build/php_5_3/sapi/cli/php -n -dmemory_limit=2G -r 'var_dump(explode(" "," 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ", -1e99));' Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 3792765909 bytes) in Command line code on line 1 # build/php_5_2/sapi/cli/php -n -dmemory_limit=2G -r 'var_dump(explode(" "," 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ", -1e99));' array(1) { [0]=> string(43) " 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 " } Previous Comments: ------------------------------------------------------------------------ [2009-03-31 19:15:47] disas at mail dot ru Description: ------------ Bug on result where negative or positive number of limit is very high. Reproduce code: --------------- #Code: var_export( explode(" "," 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ", -1e99) ); #Result: array ( 0 => ' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ', ); #Code: var_export( explode(" "," 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ", -1e9) ); #Result: array ( ) Expected result: ---------------- array ( 0 => ' 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ', ); Actual result: -------------- I think that in both cases the result should be: array( ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47854&edit=1