#29591 [NEW]: odd behavior changes in php > 4.3.4 by CURLOPT_RETURNTRANSFER

From: Date: Mon, 09 Aug 2004 17:30:10 +0000
Subject: #29591 [NEW]: odd behavior changes in php > 4.3.4 by CURLOPT_RETURNTRANSFER
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64324@lists.php.net to get a copy of this message
From: r-two at gmx dot de Operating system: linux PHP version: Irrelevant PHP Bug Type: cURL related Bug description: odd behavior changes in php > 4.3.4 by CURLOPT_RETURNTRANSFER 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 bug report at http://bugs.php.net/?id=29591&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29591&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29591&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29591&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29591&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29591&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29591&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29591&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29591&r=support Expected behavior: http://bugs.php.net/fix.php?id=29591&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29591&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29591&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29591&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29591&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29591&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29591&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29591&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29591&r=float

« previous php.bugs (#64324) next »