Skip to content

Commit

Permalink
Merge pull request #42 from mediashowroom/master
Browse files Browse the repository at this point in the history
Don't access "request"-scope when it is not active.
  • Loading branch information
rande committed May 23, 2013
2 parents eebd1c7 + 5696494 commit d247775
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Locale/RequestDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ public function __construct(ContainerInterface $container, $defaultLocale)
*/
public function getLocale()
{
if ($request = $this->container->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)) {
return $request->getLocale();
if ($this->container->isScopeActive("request")) {
if ($request = $this->container->get('request', ContainerInterface::NULL_ON_INVALID_REFERENCE)) {
return $request->getLocale();
}
}

return $this->defaultLocale;
}
}

0 comments on commit d247775

Please sign in to comment.