Actions
Bug #103669
closedBackend Preview of "planned" pages throw 503 on PHP 8.2
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
AdminPanel
Target version:
-
Start date:
2024-04-18
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:
Description
It seems like this piece of code in the PreviewSimulator is not "precise" enough for PHP 8.2 and throws a 503 if you try to preview a page from the backend, that has a start date in the future:
protected function simulateDate(ServerRequestInterface $request): bool
{
$queryTime = $request->getQueryParams()['ADMCMD_simTime'] ?? false;
if (!$queryTime) {
return false;
}
$GLOBALS['SIM_EXEC_TIME'] = $queryTime;
$GLOBALS['SIM_ACCESS_TIME'] = $queryTime - $queryTime % 60;
$this->context->setAspect(
'date',
GeneralUtility::makeInstance(
DateTimeAspect::class,
(new \DateTimeImmutable())->setTimestamp($queryTime)
)
);
return true;
}
DateTimeImmutable::setTimestamp(): Argument #1 ($timestamp) must be of type int, string given
Suggest to add a typecast early on to convert $queryTime string to the int it actually is.
Actions