8000 Check non-null type for numeric type · symfony/symfony@2797867 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 2797867

Browse files
Check non-null type for numeric type
$maxAge and $sharedAge can both be zero
1 parent 8e9aafc commit 2797867

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Bundle/FrameworkBundle/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
7 A37D 575
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)
0