Project

General

Profile

Actions

Bug #102773

closed

Static route causes type error when using EXT: syntax

Added by Lina Wolf 11 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Backend API
Target version:
-
Start date:
2024-01-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Actions #1

Updated by Lina Wolf 11 months ago

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

Actions #2

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

Actions #3

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

Actions #4

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

Actions #5

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

Actions #6

Updated by Lina Wolf 10 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF