Skip to content

Commit 045871a

Browse files
Check non-null type for numeric type
$maxAge and $sharedAge can both be zero
1 parent 88076a5 commit 045871a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Controller/TemplateController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ public function templateAction($template, $maxAge = null, $sharedAge = null, $pr
7575
throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
7676
}
7777

78-
if ($maxAge) {
78+
if (null !== $maxAge) {
7979
$response->setMaxAge($maxAge);
8080
}
8181

82-
if ($sharedAge) {
82+
if (null !== $sharedAge) {
8383
$response->setSharedMaxAge($sharedAge);
8484
}
8585

8686
if ($private) {
8787
$response->setPrivate();
88-
} elseif (false === $private || (null === $private && ($maxAge || $sharedAge))) {
88+
} elseif (false === $private || (null === $private && (null !== $maxAge || null !== $sharedAge))) {
8989
$response->setPublic();
9090
}
9191

0 commit comments

Comments
 (0)