Skip to content

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
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy