Skip to content

Commit 7c93a1b

Browse files
committed
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)
1 parent db99d69 commit 7c93a1b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Curl::setXmlDecoder($mixed)
288288
Curl::success($callback)
289289
Curl::unsetHeader($key)
290290
Curl::unsetProxy()
291-
Curl::verbose($on = true, $output = STDERR)
291+
Curl::verbose($on = true, $output = 'STDERR')
292292
MultiCurl::__construct($base_url = null)
293293
MultiCurl::__destruct()
294294
MultiCurl::addCurl(Curl $curl)

src/Curl/Curl.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,8 +1296,15 @@ public function removeHeader($key)
12961296
* @param bool $on
12971297
* @param resource $output
12981298
*/
1299-
public function verbose($on = true, $output = STDERR)
1299+
public function verbose($on = true, $output = 'STDERR')
13001300
{
1301+
if ($output === 'STDERR') {
1302+
if (!defined('STDERR')) {
1303+
define('STDERR', fopen('php://stderr', 'wb'));
1304+
}
1305+
$output = STDERR;
1306+
}
1307+
13011308
// Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
13021309
// effect of causing Curl::requestHeaders to be empty.
13031310
if ($on) {

0 commit comments

Comments
 (0)