|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-08-29 14:24 UTC] medvitz at medvitz dot net
I've got two test programs as listed.
test.php
<?
phpinfo();
?>
test1.php
<?
$ch = curl_init("http://10.0.0.100/test.php");
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"a=bb&r=beer");
echo curl_exec($ch);
curl_close($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'
Thanks,
Dave
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 21:00:01 2025 UTC |
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); } to pos = 0; while ((b = fread(buf, 1, sizeof(buf), fp)) > 0) { memcpy(&(ret_data[pos]), buf,b); pos += b; } ret_data[stat_sb.st_size-1]='\0'; 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. Thanks, Dave