From b6bf0182e970beedb85b0a39d790335295681217 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Mon, 31 Oct 2011 17:21:22 +0100 Subject: [PATCH] tweaked error handling for the forward compatibility --- src/Symfony/Component/HttpFoundation/Request.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 13415f3494..4271bb9777 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -845,18 +845,21 @@ class Request $this->format = $format; } - public function setDefaultLocale($locale) - { - $this->session->setPhpDefaultLocale($locale); - } - public function setLocale($locale) { + if (!$this->hasSession()) { + throw new \LogicException('Forward compatibility for Request::setLocale() requires the session to be set.'); + } + $this->session->setLocale($locale); } public function getLocale() { + if (!$this->hasSession()) { + throw new \LogicException('Forward compatibility for Request::getLocale() requires the session to be set.'); + } + return $this->session->getLocale(); }