/**
  * Creates a snapshot of all global and super-global variables.
  */
 private function snapshotGlobals()
 {
     $superGlobalArrays = $this->superGlobalArrays();
     foreach ($superGlobalArrays as $superGlobalArray) {
         $this->snapshotSuperGlobalArray($superGlobalArray);
     }
     foreach (array_keys($GLOBALS) as $key) {
         if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && $this->canBeSerialized($GLOBALS[$key]) && !$this->blacklist->isGlobalVariableBlacklisted($key)) {
             $this->globalVariables[$key] = unserialize(serialize($GLOBALS[$key]));
         }
     }
 }
Exemplo n.º 2
0
 public function testGlobalVariableCanBeBlacklisted()
 {
     $this->blacklist->addGlobalVariable('variable');
     $this->assertTrue($this->blacklist->isGlobalVariableBlacklisted('variable'));
 }