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 e53bf5839b ,
which has the nasty side effect of making the Validator component test
suite break with this message:

Validation failed: No DTD found!
This commit is contained in:
Grégoire Paris 2019-04-06 17:06:10 +02:00 committed by Fabien Potencier
parent f88a79b550
commit dde74aa8c9

View File

@ -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];
}