PHP :: Bug #30475 :: Curl curl_getinfo()
| Bug #30475 | Curl curl_getinfo() | ||||
|---|---|---|---|---|---|
| Submitted: | 2004-10-18 23:02 UTC | Modified: | 2004-10-19 00:43 UTC | ||
| From: | mikeb at xamo dot com | Assigned: | |||
| Status: | Closed | Package: | cURL related | ||
| PHP Version: | 5.0.2 | OS: | FreeBSD 4.8 | ||
| Private report: | No | CVE-ID: | None | ||
[2004-10-18 23:02 UTC] mikeb at xamo dot com
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.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-10-19 00:43 UTC] iliaa@php.net