|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38891 curlwrappers fail
Submitted: 2006-09-20 07:05 UTC Modified: 2006-09-25 16:02 UTC
From: hannes dot magnusson at gmail dot com Assigned: iliaa (profile)
Status: Closed Package: cURL related
PHP Version: 5CVS-2006-09-20 (CVS) OS: FreeBSD
Private report: No CVE-ID: None
 [2006-09-20 07:05 UTC] hannes dot magnusson at gmail dot com
The following script fails --with-curlwrappers, works fine 
without them.

Reproduce code:
php -r 'get_headers(""); get_headers("");'

Actual result:
FATAL:  emalloc():  Unable to allocate 1515870811 bytes
Segmentation fault: 11 (core dumped)

#0  0x28c42a17 in kill () from /lib/
#1  0x08257fd9 in _emalloc (size=1515870811, 
__zend_filename=0x8356700 "/usr/src/php/5.1/Zend/zend_API.c", 
__zend_lineno=1149, __zend_orig_filename=0x0,
at /usr/src/php/5.1/Zend/zend_alloc.c:206
#2  0x082583ed in _estrndup (s=0x853d824 "\b", 
__zend_filename=0x8356700 "/usr/src/php/5.1/Zend/zend_API.c", 
    __zend_orig_filename=0x0, __zend_orig_lineno=0) 
at /usr/src/php/5.1/Zend/zend_alloc.c:440
#3  0x082712c8 in add_next_index_stringl (arg=0x0, 
str=0x853d824 "\b", length=1515870810, duplicate=1) 
at /usr/src/php/5.1/Zend/zend_API.c:1149
#4  0x082018de in zif_get_headers (ht=1, 
return_value=0x853c7a4, return_value_ptr=0x0, 
this_ptr=0x0, return_value_used=0)
    at /usr/src/php/5.1/ext/standard/url.c:683
#5  0x08288b7d in zend_do_fcall_common_helper_SPEC 
(execute_data=0xbfbfe610) at zend_vm_execute.h:200
#6  0x082884e9 in execute (op_array=0x853f524) at 
#7  0x082636b3 in zend_eval_string (str=0x853f524 "\004", 
retval_ptr=0x0, string_name=0x835f273 "Command line code")
    at /usr/src/php/5.1/Zend/zend_execute_API.c:1116
#8  0x0826384c in zend_eval_string_ex 
(str=0xbfbfea80 "get_headers(\"\"); 
get_headers(\"\");", retval_ptr=0x0,
    string_name=0x835f273 "Command line code", 
at /usr/src/php/5.1/Zend/zend_execute_API.c:1150
#9  0x082f49b4 in main (argc=3, argv=0xbfbfe958) 
at /usr/src/php/5.1/sapi/cli/php_cli.c:1182

PHP Fatal error:  Out of memory (allocated 262144) 
at /usr/src/php/5.2/Zend/zend_API.c:1205 (tried to 
allocate 1515870811 bytes) in Command line code on line 1
/usr/src/php/5.2/main/streams/streams.c(386) : Stream of 
type 'MEMORY' 0x84f0aa4 (path:(null)) was not closed
/usr/src/php/5.2/main/streams/streams.c(386) : Stream of 
type 'cURL' 0x84f07e4 (path: was not 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-23 12:00 UTC]
The segfault is fixed for now, but the driver returns wrong data, so get_headers() still doesn't work with curlwrappers.
 [2006-09-25 12:15 UTC]
Ilia, please take a look at it.
Currently I don't think it's possible to make it work with curl wrappers becasue of 2 reasons:
1) curl wrapper treats the wrapperdata in totally different way;
2) curl wrapper does not really perform the request when opening the stream; the request is performed when _reading_ the data (which is somewhat expected, though..).
 [2006-09-25 16:02 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 23:01:33 2024 UTC