Permalink
Browse files

Fixing regression and usage of `$self` in `Php` session adapter.

  • Loading branch information...
1 parent 1d8e2c6 commit 87e5119a7d364d6a172019f9cfbe77dfe29936be @davidpersson davidpersson committed Mar 3, 2014
Showing with 6 additions and 4 deletions.
  1. +6 −4 storage/session/adapter/Php.php
@@ -134,7 +134,7 @@ public function check($key, array $options = array()) {
if (!$this->isStarted() && !$this->_start()) {
throw new RuntimeException('Could not start session.');
}
- return function($self, $params) {
+ return function($class, $params) {
return Set::check($_SESSION, $params['key']);
};
}
@@ -182,7 +182,8 @@ public function write($key, $value, array $options = array()) {
if (!$this->isStarted() && !$this->_start()) {
throw new RuntimeException('Could not start session.');
}
- return function($self, $params) {
+ $self = $this;
+ return function($class, $params) use ($self) {
return $self->overwrite(
$_SESSION, Set::insert($_SESSION, $params['key'], $params['value'])
);
@@ -201,7 +202,8 @@ public function delete($key, array $options = array()) {
if (!$this->isStarted() && !$this->_start()) {
throw new RuntimeException('Could not start session.');
}
- return function($self, $params) {
+ $self = $this;
+ return function($class, $params) use ($self) {
$key = $params['key'];
$self->overwrite($_SESSION, Set::remove($_SESSION, $key));
return !Set::check($_SESSION, $key);
@@ -218,7 +220,7 @@ public function clear(array $options = array()) {
if (!$this->isStarted() && !$this->_start()) {
throw new RuntimeException('Could not start session.');
}
- return function($self, $params) {
+ return function($class, $params) {
return session_destroy();
};
}

0 comments on commit 87e5119

Please sign in to comment.