Permalink
Browse files

Fix other missing cases of is_array() in GlobalState shown up by TRAC…

…-1062 (both of these cases given a superglobal being set to an infinite iterator will cause an infinite loop).
  • Loading branch information...
1 parent a8e5396 commit 28ad146736fe16b50952aa227b906dee4e7251b2 @gsnedders gsnedders committed Jun 12, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 PHPUnit/Util/GlobalState.php
@@ -153,7 +153,8 @@ protected static function backupSuperGlobalArray($superGlobalArray)
{
self::$globals[$superGlobalArray] = array();
- if (isset($GLOBALS[$superGlobalArray])) {
+ if (isset($GLOBALS[$superGlobalArray]) &&
+ is_array($GLOBALS[$superGlobalArray])) {
foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
self::$globals[$superGlobalArray][$key] = serialize($value);
}
@@ -226,7 +227,8 @@ public static function getGlobalsAsString()
$superGlobalArrays = self::getSuperGlobalArrays();
foreach ($superGlobalArrays as $superGlobalArray) {
- if (isset($GLOBALS[$superGlobalArray])) {
+ if (isset($GLOBALS[$superGlobalArray]) &&
+ is_array($GLOBALS[$superGlobalArray])) {
foreach ($GLOBALS[$superGlobalArray] as $key => $value) {
$result .= sprintf(
'$GLOBALS[\'%s\'][\'%s\'] = %s;' . "\n",

0 comments on commit 28ad146

Please sign in to comment.