From:             for-bugs at hnw dot jp
Operating system: *
PHP version:      5.2.9
PHP Bug Type:     Arrays related
Bug description:  array operator [] has inconsistency when the array has 
PHP_MAX_INT index value.

Description:
------------
The behavior of operator [] to the array is sometimes strange or hard to
describe the specification. For instance, the array which has two index,
2147483647 and -2147483648 on 32bit environment gets strange results. See
below example:

Reproduce code:
---------------
<?php
$array=array();
$array[-2147483648]=2;
$array[2147483647]=1;
$array[]=3;
var_dump($array);

$array=array();
$array[2147483647]=1;
$array[-2147483648]=2;
$array[]=3;
var_dump($array);

Expected result:
----------------
It should be same behavior. I think, the substitution to $array[] shuold
be both failed for this case.

Actual result:
--------------
PHP Warning:  Cannot add element to the array as the next element is
already occupied in ./array-maxint-test.php on line 5
array(2) {
  [-2147483648]=>
  int(2)
  [2147483647]=>
  int(1)
}
array(3) {
  [2147483647]=>
  int(1)
  [-2147483648]=>
  int(2)
  [-2147483647]=>
  int(3)
}

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

Reply via email to