From faca308a475a934e0fc0ca19b821031740471bd6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 10 May 2018 17:59:25 +0000 Subject: [PATCH] General: In the `is_countable()` polyfill, if the provided object implements `SimpleXMLElement` or `ResourceBundle`, consider it countable. Props ayeshrajans, jrf, desrosj. Merges [43220] to the 4.9 branch. Fixes #43583. Built from https://develop.svn.wordpress.org/branches/4.9@43221 git-svn-id: http://core.svn.wordpress.org/branches/4.9@43050 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/compat.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/compat.php b/wp-includes/compat.php index d46b0e5230..596da97707 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -512,7 +512,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 + ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index d4605f7107..0dd94804dd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.6-beta1-43219'; +$wp_version = '4.9.6-beta1-43221'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.