From:             mikeb at xamo dot com
Operating system: FreeBSD 4.8
PHP version:      5.0.2
PHP Bug Type:     cURL related
Bug description:  Curl curl_getinfo()

Description:
------------
When requesting the CURLINFO_CONTENT_TYPE using curl_getinfo(), if there
is an error (such as connection error) or missing header for any reason,
running the function using specifically
curl_getinfo($fd,CURLINFO_CONTENT_TYPE) will cause a PHP core dump.

The problem seems to be that the function does not check for the instance
of the Content-Type: header before it tries to parse it.

Temporary workaround is simply not using the function, and parsing for the
data yourself.

Reproduce code:
---------------
<?
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://sell.yahoo.com/";);
curl_setopt($ch,CURLOPT_HEADER,1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
$contents=curl_exec($ch);

// the following line will cause a core dump
//    as sell.yahoo.com does not return an appropriate Content-Type
header. Also happens on connect errors.
$content_type=curl_getinfo($ch,CURLINFO_CONTENT_TYPE);


curl_close($ch);
?>

Expected result:
----------------
Should return content-type in the HTTP Header (if it exists, or
false/empty string if it doesnt exist)

Actual result:
--------------
PHP Core Dump.

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

Reply via email to