In `WP_oEmbed`, only allow `__call()` to run against a whitelist of methods, `$compat_methods`.

See #30891.

Built from https://develop.svn.wordpress.org/trunk@31148


git-svn-id: http://core.svn.wordpress.org/trunk@31129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-01-11 22:27:23 +00:00
parent a4092e90f0
commit ed4e7b01d4
2 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,8 @@ class WP_oEmbed {
public $providers = array();
public static $early_providers = array();
private $compat_methods = array( '_fetch_with_format', '_parse_json', '_parse_xml', '_parse_body' );
/**
* Constructor
*
@ -170,8 +172,11 @@ class WP_oEmbed {
* @return mixed|bool Return value of the callback, false otherwise.
*/
public function __call( $name, $arguments ) {
if ( in_array( $name, $this->compat_methods ) ) {
return call_user_func_array( array( $this, $name ), $arguments );
}
return false;
}
/**
* Takes a URL and returns the corresponding oEmbed provider's URL, if there is one.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-alpha-31147';
$wp_version = '4.2-alpha-31148';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.