Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 277133 - dev-lang/php-5.2.10 bug in large curl downloads
Summary: dev-lang/php-5.2.10 bug in large curl downloads
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: PHP Bugs
Depends on:
Reported: 2009-07-09 07:12 UTC by Christoph Kempen
Modified: 2009-07-15 21:34 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
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 -- 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.
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!