diff --git a/PHPUnit/Util/GlobalState.php b/PHPUnit/Util/GlobalState.php index f2d92987ddf..36d599010d8 100644 --- a/PHPUnit/Util/GlobalState.php +++ b/PHPUnit/Util/GlobalState.php @@ -112,7 +112,7 @@ public static function backupGlobals(array $blacklist) if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && !in_array($key, $blacklist) && - !is_callable($GLOBALS[$key])) { + !(is_object($GLOBALS[$key]) && $GLOBALS[$key] instanceof Closure)) { self::$globals['GLOBALS'][$key] = serialize($GLOBALS[$key]); } } @@ -231,7 +231,7 @@ public static function getGlobalsAsString() if (isset($GLOBALS[$superGlobalArray]) && is_array($GLOBALS[$superGlobalArray])) { foreach (array_keys($GLOBALS[$superGlobalArray]) as $key) { - if (is_callable($GLOBALS[$superGlobalArray][$key])) { + if (is_object($GLOBALS[$superGlobalArray][$key]) && $GLOBALS[$superGlobalArray][$key] instanceof Closure) { continue; } @@ -250,7 +250,7 @@ public static function getGlobalsAsString() $blacklist[] = '_PEAR_Config_instance'; foreach (array_keys($GLOBALS) as $key) { - if (!in_array($key, $blacklist) && !is_callable($GLOBALS[$key])) { + if (!in_array($key, $blacklist) && !(is_object($GLOBALS[$key]) && $GLOBALS[$key] instanceof Closure)) { $result .= sprintf( '$GLOBALS[\'%s\'] = %s;' . "\n", $key, @@ -306,7 +306,7 @@ public static function backupStaticAttributes(array $blacklist) $attribute->setAccessible(TRUE); $value = $attribute->getValue(); - if (!is_callable($value)) { + if (!(is_object($value) && $value instanceof Closure)) { $backup[$name] = serialize($value); } }