From:             
Operating system: WindowsXP SP3
PHP version:      5.3.6
Package:          Arrays related
Bug Type:         Bug
Bug description:Array autoindex[] overflow

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 bug report at https://bugs.php.net/bug.php?id=60006&edit=1
-- 
Try a snapshot (PHP 5.2):            
https://bugs.php.net/fix.php?id=60006&r=trysnapshot52
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=60006&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=60006&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=60006&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60006&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=60006&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=60006&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=60006&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=60006&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=60006&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=60006&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=60006&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=60006&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=60006&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=60006&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=60006&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=60006&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=60006&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=60006&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=60006&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=60006&r=mysqlcfg

Reply via email to