Bug #72037 [NEW]: for refuse load all of file in memeory
| From: | mojtaba dot khani at yahoo dot com | Date: | Sat, 16 Apr 2016 09:07:48 +0000 |
| Subject: | Bug #72037 [NEW]: for refuse load all of file in memeory | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200586@lists.php.net to get a copy of this message | ||
From: mojtaba dot khani at yahoo dot com
Operating system: freebsd
PHP version: 5.5Git-2016-04-16 (snap)
Package: cURL related
Bug Type: Bug
Bug description:for refuse load all of file in memeory
Description:
------------
PHP 5.5.30 (cgi-fcgi)
Test script:
---------------
ini_set('memory_limit', '-1');//no limit for update file on download.
$fp= fopen("$base.tmp", "wb");
$para=[CURLOPT_FILE=> $fp,
CURLOPT_BINARYTRANSFER=> FALSE,
CURLOPT_FOLLOWLOCATION=>true ,
CURLOPT_RETURNTRANSFER=> FALSE,
CURLOPT_CONNECTTIMEOUT=> 10 ];
if(!empty($config['update_config']['max_recv_speed']))
$para[CURLOPT_MAX_RECV_SPEED_LARGE]=
intval($config['update_config']['max_recv_speed'])*1024;
$o=CallAPI("GET",$url,FALSE,$para);
fclose($fp);
-----------------------------------------------------------------------
function CallAPI($method, $url, $data = false,$para=[])
{
$curl = curl_init();
switch ($method)
{
case "POST":
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Expect:' )
);
if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
break;
case "PUT":
curl_setopt($curl, CURLOPT_PUT, 1);
break;
default:
if ($data)
$url = sprintf("%s?%s", $url, http_build_query($data));
}
// Optional Authentication:
// curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
// curl_setopt($curl, CURLOPT_USERPWD, "username:password");
//progress
if(function_exists("progress")){
curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, 'progress');
curl_setopt($curl, CURLOPT_NOPROGRESS, false);
}
curl_setopt($curl, CURLOPT_URL, $url);
if(!empty($para)){
foreach ($para as $k=>$v)
curl_setopt($curl,$k,$v);
}
if(empty($para[CURLOPT_RETURNTRANSFER]))
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl);
curl_close($curl);
return $result;
}
--
Edit bug report at https://bugs.php.net/bug.php?id=72037&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72037&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72037&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72037&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72037&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72037&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72037&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72037&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72037&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72037&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72037&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72037&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72037&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72037&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72037&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72037&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72037&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72037&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72037&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72037&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72037&r=mysqlcfg