Skip to content

Commit

Permalink
Clear the libxml error buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed May 20, 2019
1 parent c26349a commit 23d0827
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog-7.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ public function runBare(): void
$this->unregisterCustomComparators();
$this->cleanupIniSettings();
$this->cleanupLocaleSettings();
$this->cleanupLibXml();

// Perform assertion on output.
if (!isset($e)) {
Expand Down Expand Up @@ -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();
}
}
}

0 comments on commit 23d0827

Please sign in to comment.