Skip to content

Commit a815308

Browse files
committed
minor #30912 Restore previous state for libxml option (greg0ire)
This PR was submitted for the master branch but it was merged into the 4.2 branch instead (closes #30912). Discussion ---------- Restore previous state for libxml option | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a 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! Commits ------- dde74aa Restore previous state for libxml option
2 parents f88a79b + dde74aa commit a815308

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)