Bug #53301 [Opn->Bgs]: http_build_query unexpected behavior
Edit report at http://bugs.php.net/bug.php?id=53301&edit=1
ID: 53301
Updated by: felipe@php.net
Reported by: rbysa at yahoo dot com
Summary: http_build_query unexpected behavior
-Status: Open
+Status: Bogus
Type: Bug
Package: *General Issues
Operating System: Ubuntu
PHP Version: 5.3.3
Block user comment: N
New Comment:
You need to use:
$var = array('12345678901' => 'foo');
var_dump(http_build_query($var));
As said in the other bug report.
Previous Comments:
------------------------------------------------------------------------
[2010-11-12 20:34:25] rbysa at yahoo dot com
Also I do want to mention that I saw the previous bug report on this
issue
http://bugs.php.net/bug.php?id=49023
However this bug report has been labeled "bogus" even though the
documentation
does not support the mentioned behavior.
------------------------------------------------------------------------
[2010-11-12 20:26:35] rbysa at yahoo dot com
Description:
------------
http_build_query truncates large integer keys to 12 digits regardless of
them
being passed as a string, integer, or float.
However if the integer value is cast to a string and appended with
non-integer
characters the key is not truncated.
Test script:
---------------
$var = 1234567890123
echo http_build_query($var);
$var = (string)1234567890123
echo http_build_query($var);
$var = (float)1234567890123
echo http_build_query($var);
$var = "1234567890123.asd"
echo http_build_query($var);
Expected result:
----------------
Array([0]=>1234567890123)
Array([0]=>1234567890123)
Array([0]=>1234567890123)
Array([0]=>"1234567890123.asd")
Actual result:
--------------
Array([0]=>123456789012)
Array([0]=>123456789012)
Array([0]=>123456789012)
Array([0]=>"1234567890123.asd")
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53301&edit=1
Thread (8 messages)