Edit report at http://bugs.php.net/bug.php?id=52347&edit=1

 ID:               52347
 User updated by:  2tl at mail dot ru
 Reported by:      2tl at mail dot ru
-Summary:          Long int becomes negative, when using as array key
+Summary:          Unsigned integer becomes signed and negative, when
                   using as an array key
 Status:           Open
 Type:             Bug
 Package:          Arrays related
 Operating System: Linux 2.6.33.5-124.fc13.i686.PAE
 PHP Version:      5.3.2

 New Comment:

Changed title to unsigned int


Previous Comments:
------------------------------------------------------------------------
[2010-07-15 13:59:57] 2tl at mail dot ru

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 this bug report at http://bugs.php.net/bug.php?id=52347&edit=1

Reply via email to