|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-02-20 15:18 UTC] benjcarson at digitaljunkies dot ca
Description:
------------
http_build_query segfaults if its argument is an array that has numeric indices.
gdb backtrace:
#0 php_url_encode_hash_ex (ht=0x40690c8c, formstr=0xbfffd2d0, num_prefix=0x0,
num_prefix_len=0, key_prefix=0x0, key_prefix_len=0, key_suffix=0x0,
key_suffix_len=0, type=0x0) at /usr/src/php5-200402201830/ext/standard/http.c:64
#1 0x081b962c in zif_http_build_query (ht=138264191, return_value=0x406902fc,
this_ptr=0x0, return_value_used=1)
at /usr/src/php5-200402201830/ext/standard/http.c:204
#2 0x08224ede in zend_do_fcall_common_helper (execute_data=0xbfffd470,
opline=0x40690a68, op_array=0x4069075c)
at /usr/src/php5-200402201830/Zend/zend_execute.c:2642
#3 0x0822505e in zend_do_fcall_handler (execute_data=0xbfffd470,
opline=0x40690a68, op_array=0x83dbe7f)
at /usr/src/php5-200402201830/Zend/zend_execute.c:2771
#4 0x08221388 in execute (op_array=0x4069075c)
at /usr/src/php5-200402201830/Zend/zend_execute.c:1339
#5 0x082032ff in zend_execute_scripts (type=8, retval=0x0, file_count=3)
at /usr/src/php5-200402201830/Zend/zend.c:1053
#6 0x081ca76f in php_execute_script (primary_file=0xbffff860)
at /usr/src/php5-200402201830/main/main.c:1647
#7 0x08235a2e in main (argc=2, argv=0xbffff924)
at /usr/src/php5-200402201830/sapi/cli/php_cli.c:941
Reproduce code:
---------------
<?php
$arr[0] = "a";
$q = http_build_query($arr);
echo $q;
?>
Expected result:
----------------
0=a
Actual result:
--------------
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
I should also add that http_build_query will segfault if a numeric index is used in a sub-array of its argument as well: $arr = array("foo"=>"bar", "baz"=>array("one", "two", "three")); $q = http_build_query($arr); will also segfault.