|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6419 Curl output has extra data in output
Submitted: 2000-08-29 14:24 UTC Modified: 2000-09-10 23:48 UTC
From: medvitz at medvitz dot net Assigned:
Status: Closed Package: cURL related
PHP Version: 4.0 Latest CVS (29/08/2000) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: medvitz at medvitz dot net
New email:
PHP Version: OS:


 [2000-08-29 14:24 UTC] medvitz at medvitz dot net

I've got two test programs as listed.




$ch = curl_init("");
echo curl_exec($ch);

when I run test1.php through a browser, I get 'extra' characters periodically through the page.  The characters are '????v?@'.  

The php config is :

./configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs'
                                     '--with-config-file-path=/etc/httpd' '--enable-safe-mode'
                                     '--with-exec-dir=/usr/bin' '--with-system-regex' '--disable-debug'
                                     '--enable-debugger' '--enable-magic-quotes' '--enable-track-vars'
                                     '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--with-xml'
                                     '--with-ftp' '--with-pgsql' '--enable-wddx' '--with-curl=../curl-7.1.1' '--with-zlib'




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-04 13:17 UTC]
Moving to cURL related.
 [2000-09-10 23:02 UTC] medvitz at medvitz dot net

I tracked down this problem.  Basically, the strcat function was the culprit.  In the curl_exec function I added a unsigned long pos, and then changed the loop that looked like

while ((b = fread(buf, 1, sizeof(buf), fp)) > 0) {
strcat(ret_data, buf);


pos = 0;
while ((b = fread(buf, 1, sizeof(buf), fp)) > 0) {
	memcpy(&(ret_data[pos]), buf,b);
	pos += b;

If someone with CVS access could fix this....

Also, I've made a mod to my code with respects to  bug 6656
This is a problem that I was having, and just corrected in my source.
Basically, the curl_handle pointer in the curl_init() function never gets malloc() ed.

I added the following line immediately following the variable declarations, and it resolved the issue.

curl_handle = (php_curl *)malloc(sizeof(php_curl));

WARNING.  Someone who is more adept with the PHP internals, please verify this solution, as I fear that it may cause a memory leak somewhere, and am not sure where to properly clean this up!!!!!

I apologize for putting this info here, but, I can't add it to the bug report as I do not have CVS access.


 [2000-09-10 23:48 UTC]
Fixed in CVS.  Thanks!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Apr 11 23:01:23 2021 UTC