Fix use of undefined constant STDERR under certain conditions.

Error message:
    Use of undefined constant STDERR - assumed 'STDERR' (this will throw
    an Error in a future version of PHP)
This commit is contained in:
Zach Borboa
2020-02-21 08:19:55 -08:00
parent db99d69aac
commit 7c93a1b746
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ Curl::setXmlDecoder($mixed)
Curl::success($callback)
Curl::unsetHeader($key)
Curl::unsetProxy()
Curl::verbose($on = true, $output = STDERR)
Curl::verbose($on = true, $output = 'STDERR')
MultiCurl::__construct($base_url = null)
MultiCurl::__destruct()
MultiCurl::addCurl(Curl $curl)
+8 -1
View File
@@ -1296,8 +1296,15 @@ class Curl
* @param bool $on
* @param resource $output
*/
public function verbose($on = true, $output = STDERR)
public function verbose($on = true, $output = 'STDERR')
{
if ($output === 'STDERR') {
if (!defined('STDERR')) {
define('STDERR', fopen('php://stderr', 'wb'));
}
$output = STDERR;
}
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
// effect of causing Curl::requestHeaders to be empty.
if ($on) {