Bug #52347 [Opn->Bgs]: Unsigned integer becomes signed and negative, when using as an array key

From: Date: Tue, 30 Nov 2010 13:25:28 +0000
Subject: Bug #52347 [Opn->Bgs]: Unsigned integer becomes signed and negative, when using as an array key
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-156587@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52347&edit=1

 ID:                 52347
 Updated by:         iliaa@php.net
 Reported by:        2tl at mail dot ru
 Summary:            Unsigned integer becomes signed and negative, when
                     using as an array key
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Arrays related
 Operating System:   Linux 2.6.33.5-124.fc13.i686.PAE
 PHP Version:        5.3.2
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------
[2010-07-15 14:05:16] 2tl at mail dot ru

Changed title to unsigned int

------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.bugs (#156587) next »