mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 07:37:44 +02:00
Run version_compare only once for wp_clone(). Props sambauers. fixes #8844 for 2.7
git-svn-id: http://svn.automattic.com/wordpress/branches/2.7@10351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
024dee654b
commit
ade329213d
@ -2905,8 +2905,12 @@ function wp_suspend_cache_invalidation($suspend = true) {
|
||||
* @param object $object The object to clone
|
||||
* @return object The cloned object
|
||||
*/
|
||||
function wp_clone($object) {
|
||||
return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
|
||||
function wp_clone( $object ) {
|
||||
static $can_clone;
|
||||
if ( !isset( $can_clone ) ) {
|
||||
$can_clone = version_compare( phpversion(), '5.0', '>=' );
|
||||
}
|
||||
return $can_clone ? clone $object : $object;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user