php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59496 HttpRequest crashes
Submitted: 2010-11-06 03:10 UTC Modified: 2011-03-24 04:56 UTC
From: giampaolo at tomassoni dot biz Assigned: mike (profile)
Status: Not a bug Package: pecl_http (PECL)
PHP Version: 5_3 SVN-2010-11-05 (dev) OS: Linux 2.6.34 amd64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: giampaolo at tomassoni dot biz
New email:
PHP Version: OS:

 

 [2010-11-06 03:10 UTC] giampaolo at tomassoni dot biz
Description:
------------
I found this problem with respect to PHP 5.3.3 (which is not in the "PHP version" list) on amd64 architecture. On the x86 one, it works.

pecl_http from at least 1.6.6 reproducibly crashes executing the "reproduce code" below.

Reproduce code:
---------------
<?php
$req = new HttpRequest('http://127.0.0.1/index.html');
$req->setHeaders(array('Host' => 'www.example.com'));
$http =& $req->send();
echo($http->getResponseCode());
?>


Expected result:
----------------
302 or 404, depending on your web server config

Actual result:
--------------
Segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-06 03:15 UTC] giampaolo at tomassoni dot biz
Please note the problem seems related bug#15499 . In fact, I solved it by applying a similar patch:

--- pecl_http-1.7.0/http_request_object.c       2010-11-05 20:59:26.000000000 +0100
+++ pecl_http-1.7.0-patched/http_request_object.c       2010-11-05 20:58:03.000000000 +0100
@@ -786,7 +786,7 @@

 static int apply_pretty_key(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
 {
-       if (hash_key->arKey && hash_key->nKeyLength > 1) {
+       if (hash_key->h == NULL && hash_key->arKey && hash_key->nKeyLength > 1) {
                hash_key->h = zend_hash_func(pretty_key(hash_key->arKey, hash_key->nKeyLength - 1, 1, 0), hash_key->nKeyLength);
        }
        return ZEND_HASH_APPLY_KEEP;
 [2011-03-24 04:56 UTC] mike@php.net
Thank you for taking the time to report a problem with the package.
Unfortunately you are not using a current version of the package -- 
the problem might already be fixed. Please download a new
version from http://pecl.php.net/packages.php

If you are able to reproduce the bug with one of the latest
versions, please change the package version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PECL.

Cannot reproduce.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC