Skip to content
Snippets Groups Projects
Commit 6af53781 authored by Pavel Břoušek's avatar Pavel Břoušek Committed by Tim van Dijen
Browse files

allow session.check_function to be any Callable (#1263)

parent 6607b7fb
No related branches found
No related tags found
No related merge requests found
...@@ -174,9 +174,8 @@ class Session implements \Serializable, Utils\ClearableState ...@@ -174,9 +174,8 @@ class Session implements \Serializable, Utils\ClearableState
$this->markDirty(); $this->markDirty();
// initialize data for session check function if defined // initialize data for session check function if defined
$checkFunction = self::$config->getArray('session.check_function', null); $checkFunction = self::$config->getValue('session.check_function', null);
if (isset($checkFunction)) { if (is_callable($checkFunction)) {
assert(is_callable($checkFunction));
call_user_func($checkFunction, $this, true); call_user_func($checkFunction, $this, true);
} }
} }
...@@ -367,9 +366,8 @@ class Session implements \Serializable, Utils\ClearableState ...@@ -367,9 +366,8 @@ class Session implements \Serializable, Utils\ClearableState
} }
// run session check function if defined // run session check function if defined
$checkFunction = $globalConfig->getArray('session.check_function', null); $checkFunction = $globalConfig->getValue('session.check_function', null);
if (isset($checkFunction)) { if (is_callable($checkFunction)) {
assert(is_callable($checkFunction));
$check = call_user_func($checkFunction, $session); $check = call_user_func($checkFunction, $session);
if ($check !== true) { if ($check !== true) {
Logger::warning('Session did not pass check function.'); Logger::warning('Session did not pass check function.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment