Disable external entities in ID3.

Merges [29378] to the 3.8 branch.

Built from https://develop.svn.wordpress.org/branches/3.8@29391


git-svn-id: http://core.svn.wordpress.org/branches/3.8@29169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-08-06 05:58:10 +00:00
parent 72d44b2fce
commit 1f14360fe8
1 changed files with 6 additions and 5 deletions

View File

@ -519,11 +519,12 @@ class getid3_lib
}
public static function XML2array($XMLstring) {
if (function_exists('simplexml_load_string')) {
if (function_exists('get_object_vars')) {
$XMLobject = simplexml_load_string($XMLstring);
return self::SimpleXMLelement2array($XMLobject);
}
if ( function_exists( 'simplexml_load_string' ) && function_exists( 'libxml_disable_entity_loader' ) ) {
$loader = libxml_disable_entity_loader( true );
$XMLobject = simplexml_load_string( $XMLstring, 'SimpleXMLElement', LIBXML_NOENT );
$return = self::SimpleXMLelement2array( $XMLobject );
libxml_disable_entity_loader( $loader );
return $return;
}
return false;
}