Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 277133

Summary: dev-lang/php-5.2.10 bug in large curl downloads
Product: Gentoo Linux Reporter: Christoph Kempen <me>
Component: [OLD] DevelopmentAssignee: PHP Bugs <php-bugs>
Status: VERIFIED TEST-REQUEST    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Christoph Kempen 2009-07-09 07:12:23 UTC
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

Reproducible: Always

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 );


Actual Results:  
bad PDF file

Expected Results:  
correct PDF-file
Comment 1 Christian Hoffmann (RETIRED) gentoo-dev 2009-07-09 20:08:37 UTC
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.
Thanks.
Comment 2 Christian Hoffmann (RETIRED) gentoo-dev 2009-07-09 20:09:29 UTC
And if you've still got problems, it might help if you posted emerge -pv php in addition.
Closing as TEST-REQUEST for now.
Comment 3 Christoph Kempen 2009-07-15 21:34:12 UTC
Yes. Using php-5.2.10-r1 version fixes the problem!

thanx!