#29591 [Opn->Bgs]: odd behavior changes in php > 4.3.4 by CURLOPT_RETURNTRANSFER
| From: | iliaa@php.net | Date: | Mon, 04 Oct 2004 02:10:29 +0000 |
| Subject: | #29591 [Opn->Bgs]: odd behavior changes in php > 4.3.4 by CURLOPT_RETURNTRANSFER | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67061@lists.php.net to get a copy of this message | ||
ID: 29591
Updated by: iliaa@php.net
Reported By: r-two at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: cURL related
Operating System: linux
PHP Version: Irrelevant
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Output options are exclusive.
Previous Comments:
------------------------------------------------------------------------
[2004-08-09 19:30:09] r-two at gmx dot de
Description:
------------
I dont know exactly if this is a bug or just misentry in the
Documentation. So I simply start with the code responsible for this
behavior.
curl.h line 848:
case CURLOPT_RETURNTRANSFER:
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->method = PHP_CURL_RETURN;
} else {
ch->handlers->write->method = PHP_CURL_STDOUT;
}
break;
as you can see, the write->method is set to STDOUT if the value is 0.
This could be very perplexing if the write->method has previously
change. (with CURLOPT_FILE in my example)
a simply solution would be to cut the else tree and just change the
wirte->method by an none zero value.
a better one could be to rewrite the curl ext in a way that multible
write methods can be handeled.
Surely this is not a "real" bug, but either the documentation or the
code is wrong and in my opinion it's the code.
Kind regards,
Martin Hoch
Reproduce code:
---------------
<?php
$ch = curl_init("http://www.php.net/");
$fp = fopen("example_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>
Expected result:
----------------
As descripted above i expected the curl output in the file...
Actual result:
--------------
...but it occurs in stdout.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29591&edit=1