handle warnings and log them

This commit is contained in:
jacek 2015-05-18 14:51:55 +02:00
parent 69b9abc0af
commit 7ad0c01c19

View file

@ -51,8 +51,17 @@ class XmlParser {
*/
public function getDataFromXmlString( $xmlString ) {
wfProfileIn( __METHOD__ );
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 ] );
}
libxml_clear_errors();
throw new XmlMarkupParseErrorException();
}