Skip to content

Commit 46bb219

Browse files
Arman-HosseiniRobin Chalas
authored andcommitted
Ensure $request->hasSession() is always checked before calling getSession()
1 parent c59c5bb commit 46bb219

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Templating/GlobalVariables.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public function getRequest()
7575
*/
7676
public function getSession()
7777
{
78-
if ($request = $this->getRequest()) {
79-
return $request->getSession();
80-
}
78+
$request = $this->getRequest();
79+
80+
return $request && $request->hasSession() ? $request->getSession() : null;
8181
}
8282

8383
/**

0 commit comments

Comments
 (0)