10000 bug #35161 [FrameworkBundle] Check non-null type for numeric type (Ar… · symfony/symfony@5144487 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5144487

Browse files
committed
bug #35161 [FrameworkBundle] Check non-null type for numeric type (Arman-Hosseini)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Check non-null type for numeric type $maxAge and $sharedAge can both be zero | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | License | MIT Commits ------- 2797867 Check non-null type for numeric type
2 parents 6c96706 + 2797867 commit 5144487

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)
0