Using curl in php scripts using version 5.2.10 works fin for downloading webpages. But when downloading 'larger' PDF files (>12K) the file is corrupt when saving to the filesystem.
In the previous 5.2.9-r2 all works well
Steps to Reproduce:
$ch = curl_init ( $pdf_url );
$fp = fopen ( $path, "w" );
curl_setopt ( $ch, CURLOPT_FILE, $fp );
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
curl_exec ( $ch );
curl_close ( $ch );
fclose ( $fp );
bad PDF file
This is probably related to http://bugs.php.net/bug.php?id=48518 -- the bugfix for this issue caused a regression in php-5.2.10, but I don't know the exact symptoms. Rasmus' example on the bug suggests that it might fail to flush the downloaded data to disk which could indeed result in your reported corruption. I have added the patch to php-5.2.10-r1 anyway, so please retry with this version and report back.
And if you've still got problems, it might help if you posted emerge -pv php in addition.
Closing as TEST-REQUEST for now.
Yes. Using php-5.2.10-r1 version fixes the problem!