Check non-null type for numeric type
$maxAge and $sharedAge can both be zero
This commit is contained in:
parent
8e9aafc84f
commit
2797867ae9
@ -75,17 +75,17 @@ class TemplateController implements ContainerAwareInterface
|
|||||||
throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
|
throw new \LogicException('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($maxAge) {
|
if (null !== $maxAge) {
|
||||||
$response->setMaxAge($maxAge);
|
$response->setMaxAge($maxAge);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sharedAge) {
|
if (null !== $sharedAge) {
|
||||||
$response->setSharedMaxAge($sharedAge);
|
$response->setSharedMaxAge($sharedAge);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($private) {
|
if ($private) {
|
||||||
$response->setPrivate();
|
$response->setPrivate();
|
||||||
} elseif (false === $private || (null === $private && ($maxAge || $sharedAge))) {
|
} elseif (false === $private || (null === $private && (null !== $maxAge || null !== $sharedAge))) {
|
||||||
$response->setPublic();
|
$response->setPublic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user