Преглед изворни кода

TICKET #9557: session isn't required when using http basic authentification mecanism for example

Cyril Quintin пре 14 година
родитељ
комит
310a6c99a2
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

+ 4 - 1
src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php

@@ -160,7 +160,10 @@ class ExceptionListener implements ListenerInterface
             $this->logger->debug('Calling Authentication entry point');
         }
 
-        $request->getSession()->set('_security.target_path', $request->getUri());
+        // session isn't required when using http basic authentification mecanism for example
+        if ($request->hasSession()) {
+            $request->getSession()->set('_security.target_path', $request->getUri());
+        }
 
         return $this->authenticationEntryPoint->start($event, $request, $authException);
     }