Skip to content

Curl->download() - supplied argument is not a valid File-Handle resource #159

@antons-

Description

@antons-

When I attempt to use this function I receive the following warning. The file still downloads successfully though:

[Warning] curl_setopt(): supplied argument is not a valid File-Handle resource
* curl_setopt(Resource id #49,10001,)
  Curl.php:430
* Curl\Curl->setOpt(10001,)
  Curl.php:195

This is the code I'm using:

$curl = new Curl();
$curl->setOpt(CURLOPT_ENCODING, 'gzip');
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
$curl->download('https://domain.com/controller/action', '/var/www/project/assets/file.tar.gz');

if ($curl->error) {
    usererror('Error: ' . $curl->error_code . ': ' . $curl->error_message);
}
$curl->close();

If I delete line 195 in Curl.php, I no longer see the warning.

$this->setOpt(CURLOPT_FILE, STDOUT);

I'm not sure if this is a bug or I'm doing something wrong? If it helps I'm running PHP 5.5.9 and using php-curl-class 3.4.3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions