From: benjcarson at digitaljunkies dot ca
Operating system: Linux
PHP version: 5CVS-2004-02-20 (dev)
PHP Bug Type: *URL Functions
Bug description: http_build_query segfaults when passing an array with numeric indices
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
--
Edit bug report at http://bugs.php.net/?id=27335&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27335&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27335&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27335&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27335&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27335&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27335&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27335&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27335&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27335&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27335&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27335&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27335&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27335&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27335&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27335&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27335&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27335&r=float