Fix consistency in sessions not found exceptions
This commit is contained in:
parent
a12db94a06
commit
7fcb76d367
@ -4,6 +4,7 @@ CHANGELOG
|
|||||||
5.3
|
5.3
|
||||||
---
|
---
|
||||||
|
|
||||||
|
* Calling `Request::getSession()` when there is no available session throws a `SessionNotFoundException`
|
||||||
* Add the `RequestStack::getSession` method
|
* Add the `RequestStack::getSession` method
|
||||||
* Deprecate the `NamespacedAttributeBag` class
|
* Deprecate the `NamespacedAttributeBag` class
|
||||||
* added `ResponseFormatSame` PHPUnit constraint
|
* added `ResponseFormatSame` PHPUnit constraint
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\HttpFoundation;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
|
use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException;
|
||||||
use Symfony\Component\HttpFoundation\Exception\JsonException;
|
use Symfony\Component\HttpFoundation\Exception\JsonException;
|
||||||
|
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
|
||||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
|
|
||||||
@ -735,7 +736,7 @@ class Request
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $session) {
|
if (null === $session) {
|
||||||
throw new \BadMethodCallException('Session has not been set.');
|
throw new SessionNotFoundException('Session has not been set.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $session;
|
return $session;
|
||||||
|
Reference in New Issue
Block a user