|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-12 20:26 UTC] 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") PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 10:00:01 2025 UTC |
You need to use: $var = array('12345678901' => 'foo'); var_dump(http_build_query($var)); As said in the other bug report.I got the expected result... Array ( [1234567890123] => foo )PHP Version 5.2.4-2ubuntu5.10 Here is another test case $test = array('123456789012345=>'9780553', 1=>12312312312); print_r($test) //This line looks correct echo http_build_query($test) //This line does not Here is the output Array ( [123456789012345] => 9780553 [1] => 12312312312 ) 123456789012=9780553&1=12312312312