Bug #102773
closedStatic route causes type error when using EXT: syntax
100%
Description
When I define a static route like this in TYPO3 v12.4.9, PHP 8.2:
routes: - route: robots.txt type: staticText source: 'EXT:my_sitepackage_mysite/Resources/Public/robots.txt'
I get a type error:
TYPO3\CMS\Core\Http\HtmlResponse::__construct(): Argument #1 ($content) must be of type string, null given, called in /var/www/html/vendor/typo3/cms-frontend/Classes/Middleware/StaticRouteResolver.php on line 60
I would expect the EXT syntax to work here. But even if the file is not found it should not cause a PHP type Error
Files
Updated by Lina Wolf 11 months ago
- File clipboard-202401080957-heqww.png clipboard-202401080957-heqww.png added
- Assignee set to Lina Wolf
After some investigation what happened here is the following:
- I first saved the static route as type "staticText" in the site module.
Then switched to using type "uri" with "EXT:mysitepackage/.." in the site module.
After saving no red error or some such is displayed but when I open the static file page again I get:
And some inconsistent data is saved into the config.yaml:
routes: - route: robots.txt type: staticText source: 'EXT:my_sitepackage_mysite/Resources/Public/robots.txt'
Note how the type staticText is used but a source, not a content displayed?
Now in the StaticRouteResolver, line 142 we just expect the "content" is set in the $routeConfig array for that type, which it is not after the GUI messed up the file.
I could not reproduce how the YAML got messed up in current main
Updated by Gerrit Code Review 11 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82367
Updated by Gerrit Code Review 11 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82367
Updated by Gerrit Code Review 10 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82367
Updated by Gerrit Code Review 10 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82478
Updated by Lina Wolf 10 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 3dc75cf86d23484123b477478cad99d10d590e66.