customFileUploadDir - Restrict remote access
[civicrm-core.git] / CRM / Utils / GlobalStack.php
index 6dedf152a0a3904ba40e16fd4d4d4f7f78957882..97e5e3cd0a961c87af2bf63e36b202b195d522c9 100644 (file)
@@ -1,6 +1,6 @@
 <?php /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -80,8 +80,12 @@ class CRM_Utils_GlobalStack {
   public function createBackup($new) {
     $frame = array();
     foreach ($new as $globalKey => $values) {
-      foreach ($values as $key => $value) {
-        $frame[$globalKey][$key] = CRM_Utils_Array::value($key, $GLOBALS[$globalKey]);
+      if (is_array($values)) {
+        foreach ($values as $key => $value) {
+          $frame[$globalKey][$key] = CRM_Utils_Array::value($key, $GLOBALS[$globalKey]);
+        }
+      } else {
+        $frame[$globalKey] = CRM_Utils_Array::value($globalKey, $GLOBALS);
       }
     }
     return $frame;
@@ -89,9 +93,13 @@ class CRM_Utils_GlobalStack {
 
   public function applyFrame($newFrame) {
     foreach ($newFrame as $globalKey => $values) {
-      foreach ($values as $key => $value) {
-        $GLOBALS[$globalKey][$key] = $value;
+      if (is_array($values)) {
+        foreach ($values as $key => $value) {
+          $GLOBALS[$globalKey][$key] = $value;
+        }
+      } else {
+        $GLOBALS[$globalKey] = $values;
       }
     }
   }
-}
\ No newline at end of file
+}