#23539 [Csd]: curl_exec seems to produce strange results

From: Date: Mon, 19 May 2003 14:23:34 +0000
Subject: #23539 [Csd]: curl_exec seems to produce strange results
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39959@lists.php.net to get a copy of this message
ID: 23539 Updated by: sniper@php.net Reported By: ramato at squiz dot net Status: Closed Bug Type: cURL related Operating System: Redhat Linux 7.3 PHP Version: 4.3.2RC2 New Comment: Now fixed also in the stable branch. Previous Comments: ------------------------------------------------------------------------ [2003-05-17 09:12:58] sterling@php.net This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2003-05-15 01:42:26] daniel at haxx dot se Ok, I've seen users of PHP/CURL mention this before, and for some reason people tend to assume that the garbage is chunked transfer-encoding data (which is not true, since libcurl deals with the chunked data itself and hides that logic from the app). One user says he solved the problem by using curl_setopt(curlopt_returntransfer,1) (http://curl.haxx.se/mail/curlphp-2003-04/0013.html). That could give you a hint of where to look for this. Looking at the current ext/curl/interface.c code in CVS, I can only see a very minor bug that I think doesn't make any difference at this point. Patch for this follows here: diff -u -r1.15 interface.c --- interface.c 9 May 2003 01:10:18 -0000 1.15 +++ interface.c 15 May 2003 06:40:56 -0000 @@ -374,7 +374,7 @@ switch (t->method) { case PHP_CURL_STDOUT: - PHPWRITE(data, size); + PHPWRITE(data, length); break; case PHP_CURL_FILE: return fwrite(data, size, nmemb, t->fp); @@ -483,7 +483,7 @@ if (ch->handlers->write->method == PHP_CURL_RETURN) { smart_str_appendl(&ch->handlers->write->buf, data, (int) length); } else { - PHPWRITE(data, size); + PHPWRITE(data, length); } break; case PHP_CURL_FILE: ------------------------------------------------------------------------ [2003-05-14 21:03:55] iliaa@php.net Daniel, I do not believe it is curl_easy_perform(), who is at fault here, but the strange text that I can see occurs every single time and definately is not printed by anything inside PHP. Unfortunately I am not fluent in libcurl source to give you much more information then that. I did however write a small scirpt that is the equivalent of the above code in C (well, it does the same thing) and did not get any strange text. ------------------------------------------------------------------------ [2003-05-14 05:12:42] drhelper at mail dot ru Snapshot php4-STABLE-200305140730 this bug exist up to the point. Any curl_exec() produces random text output. ------------------------------------------------------------------------ [2003-05-12 06:39:17] daniel at haxx dot se Are you saying that curl_easy_perform() behaves wrongly or that you use the output from it badly in the PHP/CURL glue code? If it is the first, can you provide a small test code that shows the problem? (libcurl maintainer) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23539 -- Edit this bug report at http://bugs.php.net/?id=23539&edit=1

« previous php.bugs (#39959) next »