General: In the `is_countable()` polyfill, if the provided object implements `SimpleXMLElement` or `ResourceBundle`, consider it countable.

Props ayeshrajans, jrf, desrosj.
Fixes #43583.
Built from https://develop.svn.wordpress.org/trunk@43220


git-svn-id: http://core.svn.wordpress.org/trunk@43049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-05-10 17:58:22 +00:00
parent f766c46904
commit 29d5e980cc
2 changed files with 6 additions and 2 deletions

View File

@ -520,7 +520,11 @@ if ( ! function_exists( 'is_countable' ) ) {
* @return bool True if `$var` is countable, false otherwise.
*/
function is_countable( $var ) {
return ( is_array( $var ) || $var instanceof Countable );
return ( is_array( $var )
|| $var instanceof Countable
|| $var instanceof SimpleXMLElement
|| $var instanceof ResourceBundle
);
}
}

View File

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