Commit abe2e7e8 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

[FIX] Tentative de réagir en cas d'erreur 'PHP Fatal error: Uncaught...

[FIX] Tentative de réagir en cas d'erreur 'PHP Fatal error:  Uncaught Zend\Session\Exception\RuntimeException: Session validation failed in ... SessionManager.php:160'
parent 63f4a799
Pipeline #11400 passed with stage
in 50 seconds
...@@ -4,6 +4,7 @@ namespace UnicaenAuth\Authentication\Storage; ...@@ -4,6 +4,7 @@ namespace UnicaenAuth\Authentication\Storage;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use Laminas\Authentication\Storage\Session; use Laminas\Authentication\Storage\Session;
use Laminas\Session\Exception\RuntimeException;
use Laminas\Session\SessionManager; use Laminas\Session\SessionManager;
class AuthFactory class AuthFactory
...@@ -19,7 +20,18 @@ class AuthFactory ...@@ -19,7 +20,18 @@ class AuthFactory
$sessionManager = $container->get(SessionManager::class); $sessionManager = $container->get(SessionManager::class);
$storage = new Auth(); $storage = new Auth();
$storage->setStorage(new Session(Usurpation::class, null, $sessionManager));
try {
$storage->setStorage(new Session(Usurpation::class, null, $sessionManager));
} catch (RuntimeException $e) {
/**
* Tentative de réagir en cas d'erreur suivante :
* "PHP Fatal error: Uncaught Zend\Session\Exception\RuntimeException: Session validation failed in
* /var/www/sygal/vendor/zendframework/zend-session/src/SessionManager.php:160"
*/
$sessionManager->regenerateId(true);
$storage->setStorage(new Session(Usurpation::class, null, $sessionManager));
}
return $storage; return $storage;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment