Skip to content

Commit dde74aa

Browse files
greg0irefabpot
authored andcommitted
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 e53bf58 , which has the nasty side effect of making the Validator component test suite break with this message: Validation failed: No DTD found!
1 parent f88a79b commit dde74aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/Translation/Command/XliffLintCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function validate($content, $file = null)
115115
return ['file' => $file, 'valid' => true];
116116
}
117117

118-
libxml_use_internal_errors(true);
118+
$internal = libxml_use_internal_errors(true);
119119

120120
$document = new \DOMDocument();
121121
$document->loadXML($content);
@@ -143,6 +143,9 @@ private function validate($content, $file = null)
143143
];
144144
}
145145

146+
libxml_clear_errors();
147+
libxml_use_internal_errors($internal);
148+
146149
return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors];
147150
}
148151

0 commit comments

Comments
 (0)