ID: 39034 Updated by: [EMAIL PROTECTED] Reported By: james dot gauth at gmail dot com -Status: Open +Status: Assigned -Bug Type: cURL related +Bug Type: Feature/Change Request Operating System: Debian PHP Version: 4.4.4 -Assigned To: +Assigned To: iliaa
Previous Comments: ------------------------------------------------------------------------ [2006-10-04 09:06:33] james dot gauth at gmail dot com Description: ------------ When calling curl_exec() with the CURLOPT_RETURNTRANSFER option set to true, a user expects that curl_exec() will return the string value of the request. When the URL of the request in question points to a zero-byte file, curl_exec() returns bool(true) instead of the expected empty string. The versions I am using are: PHP 4.4.4 (cli) (built: Sep 11 2006 10:00:33) Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies CURL Information => libcurl/7.13.2 OpenSSL/0.9.7e zlib/1.2.3 libidn/0.5.13 Reproduce code: --------------- <?php // fictional URL to an existing file with no data in it (ie. 0 byte file) $url = 'http://www.example.com/empty_file.txt'; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); // execute and return string (this should be an empty string '') $str = curl_exec($curl); curl_close($curl); // the value of $str is actually bool(true), not empty string '' var_dump($str); ?> Expected result: ---------------- string(0) "" Actual result: -------------- bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39034&edit=1