From:             for-bugs at hnw dot jp
Operating system: any
PHP version:      5.2.9
PHP Bug Type:     Arrays related
Bug description:  Inconsistent handling of huge numerical keys for array

Description:
------------
There is inconsistency in dealing with huge numerical array key.

We know PHP normalizes array key with numerical string to integer if
possible. For instance, $a["1"] is equevalent to $a[1]. However, it is not
valid about PHP_INT_MAX and ~PHP_INT_MAX (2147483647 and -2147483648 in
32bit envirionment).

Reproduce code:
---------------
<?php

$a[PHP_INT_MAX]=1;
$a[(string)PHP_INT_MAX]=2;
var_dump($a);

Expected result:
----------------
array(2) {
  [2147483647]=>
  int(2)
}

Actual result:
--------------
array(2) {
  [2147483647]=>
  int(1)
  ["2147483647"]=>
  int(2)
}

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

Reply via email to