php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66250 shutdown crash as shared extension
Submitted: 2013-12-10 01:06 UTC Modified: 2013-12-10 08:40 UTC
From: tobias382 at gmail dot com Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.5.6 OS: Ubuntu 13.10 64-bit
Private report: No CVE-ID: None
 [2013-12-10 01:06 UTC] tobias382 at gmail dot com
Description:
------------
Using pecl_http 2.0.1 with raphf, propro, and spl enabled.

Test script:
---------------
<?php
$request = new \http\Client\Request('GET', 'http://google.com');
$client = new \http\Client('curl');
$client-&lt;enqueue($request);
$client-&lt;send();

Expected result:
----------------
No output.

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'http\Exception\UnexpectedValueException' with message 'Failed to locate "curl" client request handler' in temp.php:3
Stack trace:
#0 temp.php(3): http\Client->__construct('curl')
#1 {main}
  thrown in temp.php on line 3

If no argument is passed to the http\Client constructor, the error reads "(null)" instead of "curl"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-10 02:10 UTC] dm@php.net
-Summary: http\Cllient can't find request handler +Summary: http\Client can't find request handler
 [2013-12-10 03:17 UTC] tobias382 at gmail dot com
Apparently curl.h couldn't be found, though the installer didn't appear to generate any output to indicate this issue. I installed the libcurl4-openssl-dev package, uninstalled and reinstalled pecl_http, re-ran the test script, got a segfault, and obtained this backtrace:

#0  0x00007fffefbf76c0 in ?? ()
#1  0x00007fffefe42f42 in php_persistent_handle_apply_cleanup_ex (pp=<optimized out>, arg=<optimized out>)
    at /home/matt/pear/temp/raphf/php_raphf.c:169
#2  0x00000000006f97e8 in zend_hash_apply_with_argument (ht=ht@entry=0x119e7d0, 
    apply_func=apply_func@entry=0x7fffefe42f30 <php_persistent_handle_apply_cleanup_ex>, argument=0x1103820)
    at /build/buildd/php5-5.5.3+dfsg/Zend/zend_hash.c:740
#3  0x00007fffefe4200f in php_persistent_handle_list_dtor (provider=<optimized out>, list=<optimized out>)
    at /home/matt/pear/temp/raphf/php_raphf.c:199
#4  php_persistent_handle_list_free (provider=<optimized out>, list=0x119e958) at /home/matt/pear/temp/raphf/php_raphf.c:208
#5  php_persistent_handle_list_apply_dtor (listp=0x119e958, provider=<optimized out>) at /home/matt/pear/temp/raphf/php_raphf.c:219
#6  0x00000000006f97e8 in zend_hash_apply_with_argument (ht=ht@entry=0x11037d0, 
    apply_func=apply_func@entry=0x7fffefe41ff0 <php_persistent_handle_list_apply_dtor>, argument=argument@entry=0x11037d0)
    at /build/buildd/php5-5.5.3+dfsg/Zend/zend_hash.c:740
#7  0x00007fffefe42723 in php_persistent_handle_hash_dtor (p=0x11037d0) at /home/matt/pear/temp/raphf/php_raphf.c:283
#8  0x00000000006f94f8 in zend_hash_destroy (ht=0x7ffff00452c8 <raphf_globals+8>) at /build/buildd/php5-5.5.3+dfsg/Zend/zend_hash.c:560
#9  0x00000000006f2c2b in module_destructor (module=0xf4e850) at /build/buildd/php5-5.5.3+dfsg/Zend/zend_API.c:2371
#10 0x00000000006f7eb5 in zend_hash_apply_deleter (ht=ht@entry=0xeb8ec0 <module_registry>, p=0xf4e7f0)
    at /build/buildd/php5-5.5.3+dfsg/Zend/zend_hash.c:650
#11 0x00000000006f96b8 in zend_hash_graceful_reverse_destroy (ht=0xeb8ec0 <module_registry>)
    at /build/buildd/php5-5.5.3+dfsg/Zend/zend_hash.c:687
#12 0x00000000006f155c in zend_destroy_modules () at /build/buildd/php5-5.5.3+dfsg/Zend/zend_API.c:1895
#13 0x00000000006eb79e in zend_shutdown () at /build/buildd/php5-5.5.3+dfsg/Zend/zend.c:821
#14 0x000000000068d32b in php_module_shutdown () at /build/buildd/php5-5.5.3+dfsg/main/main.c:2362
#15 0x0000000000461a76 in main (argc=2, argv=0xebb4d0) at /build/buildd/php5-5.5.3+dfsg/sapi/cli/php_cli.c:1393
 [2013-12-10 08:05 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2013-12-10 08:05 UTC] mike@php.net
The extension's configure script should have output (hard to read at the speed a modern computer generates, though)

checking for curl/curl.h... not found

We could generate a warning there, though.

Anyway, if you want request functionality by libcurl, please install your distribution's appropriate libcurl-dev package.


Regarding the shutdown crash:

What's the load order of raphf.so and http.so? raphf should be loaded prior http.so.
 [2013-12-10 08:13 UTC] mike@php.net
Hm, looks like the persistent handle cleanup is missing in MSHUTDOWN, though.
 [2013-12-10 08:39 UTC] mike@php.net
Automatic comment on behalf of mike
Revision: http://git.php.net/?p=pecl/http/pecl_http.git;a=commit;h=6f4cec25ba28e123ad85146baf8c0d1b05b326b5
Log: Fixed bug #66250 (shutdown crash as shared extension)
 [2013-12-10 08:39 UTC] mike@php.net
-Status: Feedback +Status: Closed
 [2013-12-10 08:40 UTC] mike@php.net
-Summary: http\Client can't find request handler +Summary: shutdown crash as shared extension -Assigned To: +Assigned To: mike
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 11:01:27 2024 UTC