From dde74aa8c9368a72a8b0e53033baa29843e7f312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sat, 6 Apr 2019 17:06:10 +0200 Subject: [PATCH] Restore previous state for libxml option Whenever libxml_use_internal_errors() is called, the previous value for it should be restored. This used to be the case in this piece of code, but it was wrongly removed in e53bf5839b625e5ab92ffc4859331f4f46161bc6 , which has the nasty side effect of making the Validator component test suite break with this message: Validation failed: No DTD found! --- .../Component/Translation/Command/XliffLintCommand.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index f8791a490e..9bea4d9499 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -115,7 +115,7 @@ EOF return ['file' => $file, 'valid' => true]; } - libxml_use_internal_errors(true); + $internal = libxml_use_internal_errors(true); $document = new \DOMDocument(); $document->loadXML($content); @@ -143,6 +143,9 @@ EOF ]; } + libxml_clear_errors(); + libxml_use_internal_errors($internal); + return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors]; }