#33222 [NEW]: segmentation fault when trying to run curl_close from the handler function

From: Date: Thu, 02 Jun 2005 14:55:14 +0000
Subject: #33222 [NEW]: segmentation fault when trying to run curl_close from the handler function
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-79814@lists.php.net to get a copy of this message
From:             public at grik dot net
Operating system: Linux RH9
PHP version:      5.0.4
PHP Bug Type:     cURL related
Bug description:  segmentation fault when trying to run curl_close from the handler function

Description:
------------
When I try to close CURL connection from the function, registered as a
handler for the output (header or body), PHP crashes.

Reproduce code:
---------------
<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://www.yahoo.com/");

curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'header_callback');

curl_exec($ch);

curl_close($ch);

function header_callback($ch, $string){
    echo $string;
    curl_close($ch);
    return strlen($string);
}

?>

Expected result:
----------------
HTTP/1.1 200 OK

Actual result:
--------------
HTTP/1.1 200 OK
Segmentation fault


-- 
Edit bug report at http://bugs.php.net/?id=33222&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33222&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33222&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33222&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33222&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33222&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33222&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33222&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33222&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33222&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33222&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=33222&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=33222&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33222&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33222&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33222&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33222&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33222&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33222&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33222&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33222&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#79814) next »