From 6af53781d34cc11c1e82723d8d969ae1898d2496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20B=C5=99ou=C5=A1ek?= <melanger@users.noreply.github.com> Date: Tue, 24 Dec 2019 21:14:20 +0100 Subject: [PATCH] allow session.check_function to be any Callable (#1263) --- lib/SimpleSAML/Session.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 7cef0c647..7f5228b7c 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -174,9 +174,8 @@ class Session implements \Serializable, Utils\ClearableState $this->markDirty(); // initialize data for session check function if defined - $checkFunction = self::$config->getArray('session.check_function', null); - if (isset($checkFunction)) { - assert(is_callable($checkFunction)); + $checkFunction = self::$config->getValue('session.check_function', null); + if (is_callable($checkFunction)) { call_user_func($checkFunction, $this, true); } } @@ -367,9 +366,8 @@ class Session implements \Serializable, Utils\ClearableState } // run session check function if defined - $checkFunction = $globalConfig->getArray('session.check_function', null); - if (isset($checkFunction)) { - assert(is_callable($checkFunction)); + $checkFunction = $globalConfig->getValue('session.check_function', null); + if (is_callable($checkFunction)) { $check = call_user_func($checkFunction, $session); if ($check !== true) { Logger::warning('Session did not pass check function.'); -- GitLab