php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72037 for refuse load all of file in memeory
Submitted: 2016-04-16 09:07 UTC Modified: 2016-04-24 04:22 UTC
From: mojtaba dot khani at yahoo dot com Assigned:
Status: No Feedback Package: cURL related
PHP Version: 5.5Git-2016-04-16 (snap) OS: freebsd
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mojtaba dot khani at yahoo dot com
New email:
PHP Version: OS:

 

 [2016-04-16 09:07 UTC] mojtaba dot khani at yahoo dot com
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;
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-16 09:12 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-04-16 09:12 UTC] requinix@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


Additionally, PHP 5.5 is only receiving security fixes, so make sure you test in PHP 5.6 or 7.
 [2016-04-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC