diff --git a/cake/libs/cake_session.php b/cake/libs/cake_session.php index a0b44b9cba0..2d201f81d9d 100644 --- a/cake/libs/cake_session.php +++ b/cake/libs/cake_session.php @@ -100,13 +100,6 @@ class CakeSession { */ public static $sessionTime = false; -/** - * Keeps track of keys to watch for writes on - * - * @var array - */ - public static $watchKeys = array(); - /** * Current Session id * @@ -261,9 +254,6 @@ public static function id($id = null) { */ public static function delete($name) { if (self::check($name)) { - if (in_array($name, self::$watchKeys)) { - throw new CakeSessionException(__('Deleting session key {%s}', $name)); - } self::__overwrite($_SESSION, Set::remove($_SESSION, $name)); return (self::check($name) == false); } @@ -402,46 +392,6 @@ private static function __returnSessionVars() { return false; } -/** - * Tells Session to write a notification when a certain session path or subpath is written to - * - * @param mixed $var The variable path to watch - * @return void - */ - public static function watch($var) { - if (!self::started() && !self::start()) { - return false; - } - if (empty($var)) { - return false; - } - if (!in_array($var, self::$watchKeys, true)) { - self::$watchKeys[] = $var; - } - } - -/** - * Tells Session to stop watching a given key path - * - * @param mixed $var The variable path to watch - * @return void - */ - public static function ignore($var) { - if (!self::started() && !self::start()) { - return false; - } - if (!in_array($var, self::$watchKeys)) { - return; - } - foreach (self::$watchKeys as $i => $key) { - if ($key == $var) { - unset(self::$watchKeys[$i]); - self::$watchKeys = array_values(self::$watchKeys); - return; - } - } - } - /** * Writes value to given session variable name. * @@ -461,9 +411,6 @@ public static function write($name, $value = null) { $write = array($name => $value); } foreach ($write as $key => $val) { - if (in_array($key, self::$watchKeys)) { - throw new CakeSessionException(__('Writing session key {%s}: %s', $key, var_export($val, true))); - } self::__overwrite($_SESSION, Set::insert($_SESSION, $key, $val)); if (Set::classicExtract($_SESSION, $key) !== $val) { return false; diff --git a/cake/tests/cases/libs/cake_session.test.php b/cake/tests/cases/libs/cake_session.test.php index 2c84254dd1d..e25c9416d25 100644 --- a/cake/tests/cases/libs/cake_session.test.php +++ b/cake/tests/cases/libs/cake_session.test.php @@ -88,7 +88,6 @@ function setup() { 'ini' => array(), )); TestCakeSession::init(); - TestCakeSession::$watchKeys = array(); } /** @@ -365,47 +364,6 @@ function testDelete() { $this->assertFalse(TestCakeSession::check('Clearing')); } -/** - * testWatchVar method - * - * @expectedException CakeSessionException - * @access public - * @return void - */ - function testWatchVarWrite() { - $this->assertFalse(TestCakeSession::watch(null)); - - TestCakeSession::write('Watching', "I'm watching you"); - TestCakeSession::watch('Watching'); - TestCakeSession::write('Watching', 'They found us!'); - } - -/** - * Test that deleting watched vars causes exceptions - * - * @expectedException CakeSessionException - * @return void - */ - function testWatchVarDelete() { - TestCakeSession::write('Watching', 'I am watching you.'); - - TestCakeSession::watch('Watching'); - TestCakeSession::delete('Watching'); - } - -/** - * testIgnore method - * - * @access public - * @return void - */ - function testIgnore() { - TestCakeSession::write('Watching', "I'm watching you"); - TestCakeSession::watch('Watching'); - TestCakeSession::ignore('Watching'); - $this->assertTrue(TestCakeSession::write('Watching', 'They found us!')); - } - /** * testDestroy method *