mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-06 00:18:45 +01:00
General: Introduce a polyfill for is_iterable()
function added in PHP 7.1.
Props jrf, schlessera, desrosj. Merges [43036] to the 4.9 branch. See #43619. Built from https://develop.svn.wordpress.org/branches/4.9@43037 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
408d8c63be
commit
9bee0589fb
@ -503,7 +503,7 @@ if ( ! function_exists( 'is_countable' ) ) {
|
|||||||
* Polyfill for is_countable() function added in PHP 7.3.
|
* Polyfill for is_countable() function added in PHP 7.3.
|
||||||
*
|
*
|
||||||
* Verify that the content of a variable is an array or an object
|
* Verify that the content of a variable is an array or an object
|
||||||
* implementing Countable.
|
* implementing the Countable interface.
|
||||||
*
|
*
|
||||||
* @since 4.9.6
|
* @since 4.9.6
|
||||||
*
|
*
|
||||||
@ -515,3 +515,21 @@ if ( ! function_exists( 'is_countable' ) ) {
|
|||||||
return ( is_array( $var ) || $var instanceof Countable );
|
return ( is_array( $var ) || $var instanceof Countable );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! function_exists( 'is_iterable' ) ) {
|
||||||
|
/**
|
||||||
|
* Polyfill for is_iterable() function added in PHP 7.1.
|
||||||
|
*
|
||||||
|
* Verify that the content of a variable is an array or an object
|
||||||
|
* implementing the Traversable interface.
|
||||||
|
*
|
||||||
|
* @since 4.9.6
|
||||||
|
*
|
||||||
|
* @param mixed $var The value to check.
|
||||||
|
*
|
||||||
|
* @return bool True if `$var` is iterable, false otherwise.
|
||||||
|
*/
|
||||||
|
function is_iterable( $var ) {
|
||||||
|
return ( is_array( $var ) || $var instanceof Traversable );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9.6-alpha-43035';
|
$wp_version = '4.9.6-alpha-43037';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user