Skip to content

Commit bc86425

Browse files
bug #32703 Ensure $request->hasSession() is always checked before calling getSession() (Arman-Hosseini)
This PR was merged into the 4.4 branch. Discussion ---------- Ensure $request->hasSession() is always checked before calling getSession() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 7b2c326719 Ensure $request->hasSession() is always checked before calling getSession()
2 parents d7bb940 + 46bb219 commit bc86425

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)