diff --git a/src/CurlHttpMessage/CurlReqRes.php b/src/CurlHttpMessage/CurlReqRes.php index 9887bbf7..912fa115 100644 --- a/src/CurlHttpMessage/CurlReqRes.php +++ b/src/CurlHttpMessage/CurlReqRes.php @@ -66,19 +66,19 @@ public function __construct(RequestInterface $request, callable $responseFactory */ public function __destruct() { - if (\is_resource($this->curlHandle) && \get_resource_type($this->curlHandle) === 'Unknown') { - // already closed - $this->curlHandle = null; + if (!$this->curlHandle) { return; } - if ($this->curlHandle) { - try { - \curl_close($this->curlHandle); - } catch (ErrorException $e) { - // ignore exception - } - $this->curlHandle = null; + \set_error_handler(function ($type, $message) { + // ignore error + }); + try { + \curl_close($this->curlHandle); + } catch (ErrorException $e) { + // ignore exception } + \restore_error_handler(); + $this->curlHandle = null; } /** diff --git a/tests/Backtrace/NormalizerTest.php b/tests/Backtrace/NormalizerTest.php index 28cb56a7..f263b1eb 100644 --- a/tests/Backtrace/NormalizerTest.php +++ b/tests/Backtrace/NormalizerTest.php @@ -66,13 +66,11 @@ public function testNormalize() public function testNormalizeInclude() { - $GLOBALS['gautf'] = true; $filepath = __DIR__ . '/Fixture/include.php'; require $filepath; $this->assertIncludeDebugBacktrace($filepath); $this->assertIncludeXdebug($filepath); - $GLOBALS['gautf'] = false; } protected function assertIncludeDebugBacktrace($filepath) @@ -111,9 +109,7 @@ protected function assertIncludeDebugBacktrace($filepath) protected function assertIncludeXdebug($filepath) { $trace = \array_reverse($GLOBALS['xdebug_trace']); - empty($GLOBALS['gautf']) || var_dump(\array_slice($trace, 0, 8)); $trace = Normalizer::normalize($trace); - empty($GLOBALS['gautf']) || var_dump(\array_slice($trace, 0, 8)); self::assertSame($filepath, $trace[0]['file']); self::assertSame('bdk\\Backtrace\\Xdebug::getFunctionStack', $trace[0]['function']); diff --git a/tests/Debug/Collector/GuzzleMiddlewareTest.php b/tests/Debug/Collector/GuzzleMiddlewareTest.php index f234e07b..f3eb4f57 100644 --- a/tests/Debug/Collector/GuzzleMiddlewareTest.php +++ b/tests/Debug/Collector/GuzzleMiddlewareTest.php @@ -225,19 +225,6 @@ public function testAsynchronous() 'channel' => 'general.Guzzle', ), ), - /* - 3 => array( - 'method' => 'log', - 'args' => array( - 'request body', - null, - ), - 'meta' => array( - 'redact' => true, - 'channel' => 'general.Guzzle', - ), - ), - */ 3 => array( 'method' => 'groupEnd', 'args' => array(), @@ -280,7 +267,7 @@ public function testAsynchronous() ), ); $this->assertSame($expect, $messages); - } + }, )); } diff --git a/tests/ErrorHandler/TestBase.php b/tests/ErrorHandler/TestBase.php index 2159d731..c43d50c0 100644 --- a/tests/ErrorHandler/TestBase.php +++ b/tests/ErrorHandler/TestBase.php @@ -87,6 +87,13 @@ public function tearTown(): void $this->errorHandler->eventManager->unsubscribe(ErrorHandler::EVENT_ERROR, array($this, 'onError')); } + public static function tearDownAfterClass(): void + { + foreach (self::$subscribersBackup as $subscriberInfo) { + ErrorHandler::getInstance()->eventManager->subscribe(ErrorHandler::EVENT_ERROR, $subscriberInfo['callable'], $subscriberInfo['priority']); + } + } + public function onError(Error $error) { foreach ($this->onErrorUpdate as $k => $v) { @@ -110,8 +117,6 @@ public function onError(Error $error) } $error['continueToPrevHandler'] = true; $error['throw'] = true; - - } public function emailMock($to, $subject, $body, $addHeadersStr)