From aa362d0995eb08d2d6584f08ff7c0e892fa021b7 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Thu, 9 May 2019 22:50:56 -0500 Subject: [PATCH] Attempting to fix CURLRequest debug issue. #1994 --- system/HTTP/CURLRequest.php | 2 +- tests/system/HTTP/CURLRequestTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index a0ba1ef1698a..13f91ff3be35 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -675,7 +675,7 @@ protected function setCURLOptions(array $curl_options = [], array $config = []) if (isset($config['debug'])) { $curl_options[CURLOPT_VERBOSE] = $config['debug'] === true ? 1 : 0; - $curl_options[CURLOPT_STDERR] = is_bool($config['debug']) ? fopen('php://output', 'w+') : $config['debug']; + $curl_options[CURLOPT_STDERR] = $config['debug'] === true ? fopen('php://output', 'w+') : $config['debug']; } // Decode Content diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 2dbe1eda2a98..bca261d94f5c 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -460,6 +460,15 @@ public function testDebugOption() $this->assertEquals(1, $options[CURLOPT_VERBOSE]); $this->assertArrayHasKey(CURLOPT_STDERR, $options); + $this->assertTrue(is_resource($options[CURLOPT_STDERR])); + + $this->request->request('get', 'http://example.com', [ + 'debug' => false, + ]); + + $options = $this->request->curl_options; + + $this->assertFalse($options[CURLOPT_STDERR]); } //--------------------------------------------------------------------