Skip to content
Snippets Groups Projects
Commit ff5ae8f1 authored by Olav Morken's avatar Olav Morken
Browse files

State: Add $allowMissing parameter to loadState().

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2947 44740490-163a-0410-bde0-09ae8108e29a
parent db331199
No related branches found
No related tags found
No related merge requests found
...@@ -150,12 +150,13 @@ class SimpleSAML_Auth_State { ...@@ -150,12 +150,13 @@ class SimpleSAML_Auth_State {
* *
* @param string $id State identifier (with embedded restart information). * @param string $id State identifier (with embedded restart information).
* @param string $stage The stage the state should have been saved in. * @param string $stage The stage the state should have been saved in.
* @return array State information. * @param bool $allowMissing Whether to allow the state to be missing.
* @return array|NULL State information, or NULL if the state is missing and $allowMissing is TRUE.
*/ */
public static function loadState($id, $stage) { public static function loadState($id, $stage, $allowMissing = FALSE) {
assert('is_string($id)'); assert('is_string($id)');
assert('is_string($stage)'); assert('is_string($stage)');
assert('is_bool($allowMissing)');
SimpleSAML_Logger::debug('Loading state: ' . var_export($id, TRUE)); SimpleSAML_Logger::debug('Loading state: ' . var_export($id, TRUE));
$tmp = explode(':', $id, 2); $tmp = explode(':', $id, 2);
...@@ -170,7 +171,10 @@ class SimpleSAML_Auth_State { ...@@ -170,7 +171,10 @@ class SimpleSAML_Auth_State {
$state = $session->getData('SimpleSAML_Auth_State', $id); $state = $session->getData('SimpleSAML_Auth_State', $id);
if ($state === NULL) { if ($state === NULL) {
/* Could not find saved data. Attempt to restart. */ /* Could not find saved data. */
if ($allowMissing) {
return NULL;
}
if ($restartURL === NULL) { if ($restartURL === NULL) {
throw new SimpleSAML_Error_NoState(); throw new SimpleSAML_Error_NoState();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment