From:             
Operating system: Linux 2.6.33.5-124.fc13.i686.PAE
PHP version:      5.3.2
Package:          Arrays related
Bug Type:         Bug
Bug description:Long int becomes negative, when using as array key

Description:
------------
There is a simple html form

<input type="text" name="inventory[2391649236][product_code]" />



when post it, the $_REQUEST will be as below:

Array

(

    [inventory] => Array

        (

            [-1903318060] => Array

                (

                    [product_code] => 

                )

        )

)



Why 2391649236 become -1903318060?



In my case, "2391649236" is just unique index. I got it with sprintf("%u",


crc32($my_data));

Test script:
---------------
<form>

<input type="text" name="inventory[2391649236][product_code]" />

<input type="submit" />

</form>

<?php print_r($_REQUEST) ?>

Expected result:
----------------
Array

(

    [inventory] => Array

        (

            [2391649236] => Array

                (

                    [product_code] => 

                )

        )

)

Actual result:
--------------
Array

(

    [inventory] => Array

        (

            [-1903318060] => Array

                (

                    [product_code] => 

                )

        )

)

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

Reply via email to