From 23d08274fc2179a8259a29cb3a9d77a1e802b628 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 20 May 2019 15:06:30 +0200 Subject: [PATCH] Clear the libxml error buffer --- ChangeLog-7.5.md | 4 ++++ src/Framework/TestCase.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog-7.5.md b/ChangeLog-7.5.md index e3479a909e9..27f1986c09b 100644 --- a/ChangeLog-7.5.md +++ b/ChangeLog-7.5.md @@ -4,6 +4,10 @@ All notable changes of the PHPUnit 7.5 release series are documented in this fil ## [7.5.12] - 2019-MM-DD +### Changed + +* After each test, `libxml_clear_errors()` is now called (when available) to clear the libxml error buffer + ### Fixed * Fixed [#3694](https://github.com/sebastianbergmann/phpunit/pull/3694): Constructor arguments for `Throwable` and `Exception` are ignored diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index 0c73877dede..da1c74f1bd7 100644 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -916,6 +916,7 @@ public function runBare(): void $this->unregisterCustomComparators(); $this->cleanupIniSettings(); $this->cleanupLocaleSettings(); + $this->cleanupLibXml(); // Perform assertion on output. if (!isset($e)) { @@ -2140,4 +2141,11 @@ private function runInSeparateProcess(): bool return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) && $this->inIsolation !== true && !$this instanceof PhptTestCase; } + + private function cleanupLibXml(): void + { + if (\function_exists('libxml_clear_errors')) { + \libxml_clear_errors(); + } + } }