From: emmet at trovit dot com Operating system: Mac OS X 10.6.8 PHP version: 5.3.14 Package: cURL related Bug Type: Bug Bug description:Using cURL multi to save urls to a file then reading files - files chopped
Description: ------------ I'm using curl multi to download files in parallel. In the test script I specify that I want to put the contents of the download in a file using the CURLOPT_FILE flag. The file is downloaded correctly, but when I try to file_get_contents or fopen() on the downloaded file the contents are always chopped off. If I put the contents of the file in a variable and count the length of the string it is always 40960 characters max. The file itself downloads entirely to disk, it's just PHP which won't read it all, and limits it to 40Kb. Tested with PHP 5.3.8, 5.3.13 and 5.3.14, the same thing happens with all versions. Output of php -v: PHP 5.3.8 (cli) (built: Dec 5 2011 21:24:09) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with Xdebug v2.1.2, Copyright (c) 2002-2011, by Derick Rethans PHP 5.3.13 (cli) (built: May 9 2012 07:21:29) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Xdebug v2.1.3, Copyright (c) 2002-2012, by Derick Rethans PHP 5.3.14 (cli) (built: Jun 25 2012 16:47:44) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies This bug not quite the same as this one https://bugs.php.net/bug.php?id=52558 but they could be related. Test script: --------------- I've put the code on pastebin, I can upload it again or email it if needed: http://pastebin.com/mMHVK85Z Expected result: ---------------- The script should echo out the entire contents of the newly downloaded webpage (which has been put in a local file). Actual result: -------------- Actual result is the first 40960 characters are output. Checking the file manually with a tail -f will show that the file was downloaded entirely, but PHP won't display it all. -- Edit bug report at https://bugs.php.net/bug.php?id=62409&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62409&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62409&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62409&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62409&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62409&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62409&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62409&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62409&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62409&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62409&r=support Expected behavior: https://bugs.php.net/fix.php?id=62409&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62409&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62409&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62409&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62409&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62409&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62409&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62409&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62409&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62409&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62409&r=mysqlcfg