php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58485 [PATCH] HttpRequest::addHeaders segfaults when passing array(1)
Submitted: 2009-01-03 19:26 UTC Modified: 2009-01-12 05:12 UTC
From: felipe@php.net Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5_3 CVS-2009-01-03 (dev) OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: felipe@php.net
New email:
PHP Version: OS:

 

 [2009-01-03 19:26 UTC] felipe@php.net
Description:
------------
See below.

Here's a simple patch:
http://felipe.ath.cx/diff/httprequest_addheaders.diff

Reproduce code:
---------------
$x = new HttpRequest; $x->addHeaders(array(1));

Expected result:
----------------
Nothing.

Actual result:
--------------
Starting program: /home/felipe/dev/php5/sapi/cli/php -r '$x = new HttpRequest; $x->addHeaders(array(1));'
[Thread debugging using libthread_db enabled]
[New Thread 0xb79156b0 (LWP 3465)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb79156b0 (LWP 3465)]
0x0844f087 in zend_inline_hash_func (arKey=0x0, nKeyLength=147411056) at /home/felipe/dev/php5/Zend/zend_hash.h:267
267			hash = ((hash << 5) + hash) + *arKey++;
(gdb) bt
#0  0x0844f087 in zend_inline_hash_func (arKey=0x0, nKeyLength=147411056) at /home/felipe/dev/php5/Zend/zend_hash.h:267
#1  0x0844f064 in zend_hash_func (arKey=0x0, nKeyLength=147411056) at /home/felipe/dev/php5/Zend/zend_hash.c:99
#2  0x083726df in apply_pretty_key (pDest=0x8e0db4c, num_args=147411056, args=0x0, hash_key=0xbfef63b0) at /home/felipe/dev/php5/ext/http/http_request_object.c:753
#3  0x08451260 in zend_hash_apply_with_arguments (ht=0x8e0da94, tsrm_ls=0x8c95070, apply_func=0x8372691 <apply_pretty_key>, num_args=0)
    at /home/felipe/dev/php5/Zend/zend_hash.c:729
#4  0x083736a2 in _http_request_object_set_options_subr (ht=1, return_value=0x8e0dbd8, return_value_ptr=0x0, this_ptr=0x8e0c34c, return_value_used=0, 
    tsrm_ls=0x8c95070, key=0x8768248 "headers", len=8, overwrite=0, prettify_keys=1) at /home/felipe/dev/php5/ext/http/http_request_object.c:788
#5  0x0837391c in zim_HttpRequest_addHeaders (ht=1, return_value=0x8e0dbd8, return_value_ptr=0x0, this_ptr=0x8e0c34c, return_value_used=0, tsrm_ls=0x8c95070)
    at /home/felipe/dev/php5/ext/http/http_request_object.c:991
#6  0x08472ec3 in zend_do_fcall_common_helper_SPEC (execute_data=0x8e3a63c, tsrm_ls=0x8c95070) at /home/felipe/dev/php5/Zend/zend_vm_execute.h:313
#7  0x08474042 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x8e3a63c, tsrm_ls=0x8c95070) at /home/felipe/dev/php5/Zend/zend_vm_execute.h:422
#8  0x08471c84 in execute (op_array=0x8e0ca48, tsrm_ls=0x8c95070) at /home/felipe/dev/php5/Zend/zend_vm_execute.h:104
#9  0x08431c93 in zend_eval_string (str=0xbfef789d "$x = new HttpRequest; $x->addHeaders(array(1));", retval_ptr=0x0, string_name=0x87919b8 "Command line code", 
    tsrm_ls=0x8c95070) at /home/felipe/dev/php5/Zend/zend_execute_API.c:1150
#10 0x08431eda in zend_eval_string_ex (str=0xbfef789d "$x = new HttpRequest; $x->addHeaders(array(1));", retval_ptr=0x0, 
    string_name=0x87919b8 "Command line code", handle_exceptions=1, tsrm_ls=0x8c95070) at /home/felipe/dev/php5/Zend/zend_execute_API.c:1185
#11 0x084e1c3d in main (argc=3, argv=0xbfef68b4) at /home/felipe/dev/php5/sapi/cli/php_cli.c:1177


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-12 05:12 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 21:01:28 2024 UTC