mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
Removing CakeSession::watch() and CakeSession::ignore(). You should use logging, or an interactive debugger instead.
This commit is contained in:
parent
75af48b774
commit
84414eeb07
2 changed files with 0 additions and 95 deletions
|
@ -100,13 +100,6 @@ class CakeSession {
|
||||||
*/
|
*/
|
||||||
public static $sessionTime = false;
|
public static $sessionTime = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Keeps track of keys to watch for writes on
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public static $watchKeys = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Session id
|
* Current Session id
|
||||||
*
|
*
|
||||||
|
@ -261,9 +254,6 @@ class CakeSession {
|
||||||
*/
|
*/
|
||||||
public static function delete($name) {
|
public static function delete($name) {
|
||||||
if (self::check($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));
|
self::__overwrite($_SESSION, Set::remove($_SESSION, $name));
|
||||||
return (self::check($name) == false);
|
return (self::check($name) == false);
|
||||||
}
|
}
|
||||||
|
@ -402,46 +392,6 @@ class CakeSession {
|
||||||
return false;
|
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.
|
* Writes value to given session variable name.
|
||||||
*
|
*
|
||||||
|
@ -461,9 +411,6 @@ class CakeSession {
|
||||||
$write = array($name => $value);
|
$write = array($name => $value);
|
||||||
}
|
}
|
||||||
foreach ($write as $key => $val) {
|
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));
|
self::__overwrite($_SESSION, Set::insert($_SESSION, $key, $val));
|
||||||
if (Set::classicExtract($_SESSION, $key) !== $val) {
|
if (Set::classicExtract($_SESSION, $key) !== $val) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -88,7 +88,6 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
'ini' => array(),
|
'ini' => array(),
|
||||||
));
|
));
|
||||||
TestCakeSession::init();
|
TestCakeSession::init();
|
||||||
TestCakeSession::$watchKeys = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -365,47 +364,6 @@ class CakeSessionTest extends CakeTestCase {
|
||||||
$this->assertFalse(TestCakeSession::check('Clearing'));
|
$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
|
* testDestroy method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue