Bug #55061 [Opn->Ver]: Array autoindex[] overflow
| From: | pollita@php.net | Date: | Tue, 03 Jul 2012 15:45:21 +0000 |
| Subject: | Bug #55061 [Opn->Ver]: Array autoindex[] overflow | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171715@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55061&edit=1
ID: 55061
Updated by: pollita@php.net
Reported by: vovan-ve at yandex dot ru
Summary: Array autoindex[] overflow
-Status: Open
+Status: Verified
Type: Bug
Package: Arrays related
Operating System: WindowsXP SP3
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Reproduced on Debian.
Tempting as it may be to go the string index route for values greater than
PHP_INT_MAX, I'm more inclined to get a workable Big Int in PHP first, then use
that for the index (beyond PHP_INT_MAX)
Previous Comments:
------------------------------------------------------------------------
[2012-02-27 23:45:25] vovan-ve at yandex dot ru
Reproduced with the same behaviour and result in Ubuntu 11.10 i386.
------------------------------------------------------------------------
[2011-07-29 14:39:20] vovan-ve at yandex dot ru
No, I have no non-official extensions. I have disabled all extensions for test even. May be your int
is not int32?
------------------------------------------------------------------------
[2011-07-27 06:52:24] laruence@php.net
I can not reproduce this warning, do you have non-php-official extension installed?
if yes, plz remove them then check again. thanks
------------------------------------------------------------------------
[2011-06-29 06:03:07] vovan-ve at yandex dot ru
Sorry for typo. var_dymp == var_dump
------------------------------------------------------------------------
[2011-06-29 04:47:05] vovan-ve at yandex dot ru
Description:
------------
There is a test code:
$a = array(0x7FFFFFFF => 42);
$a[] = 37;
var_dymp($a);
Second line emits warning:
Warning: Cannot add element to the array as the next element
is already occupied in ... on line 2
and doesn't add element with value 37. This is absolutely abnormal
behaviour. At least there is incorrect text for Warning. I expect,
the element should be added with any index (i.e. string "2147483648"
as the result of 0x7FFFFFFF+1 thru float), or something else. But
element was not added even.
Test script:
---------------
$a = array(0x7FFFFFFF => 42);
$a[] = 37;
var_dymp($a);
Expected result:
----------------
array(1) {
[2147483647]=>
int(42)
["2147483648"]=>
int(37)
}
OR (when int will become int64):
array(1) {
[2147483647]=>
int(42)
[2147483648]=>
int(37)
}
Actual result:
--------------
Warning: Cannot add element to the array as the next element is already occupied in ... on line 2
array(1) {
[2147483647]=>
int(42)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55061&edit=1