This commit is contained in:
jacek 2015-05-18 15:36:04 +02:00
parent 7ad0c01c19
commit 808026dae1

View file

@ -51,17 +51,21 @@ class XmlParser {
*/
public function getDataFromXmlString( $xmlString ) {
wfProfileIn( __METHOD__ );
$global_libxml_setting = libxml_use_internal_errors();
libxml_use_internal_errors( true );
$xml = simplexml_load_string( $xmlString );
if ( $xml === false ) {
$errors = libxml_get_errors();
foreach ( $errors as $xmlerror ) {
\Wikia\Logger\WikiaLogger::instance()->debug( "PortableInfobox XML Parser problem", [
"level" => $xmlerror->level,
"code" => $xmlerror->code,
"message" => $xmlerror->message ] );
if ( $xmlerror->level >= LIBXML_ERR_ERROR ) {
\Wikia\Logger\WikiaLogger::instance()->debug( "PortableInfobox XML Parser problem", [
"level" => $xmlerror->level,
"code" => $xmlerror->code,
"message" => $xmlerror->message ] );
}
}
libxml_clear_errors();
libxml_use_internal_errors( $global_libxml_setting );
throw new XmlMarkupParseErrorException();
}