95333[BUGFIX] Handle backend logo as system resource
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Oliver Klee +1
- Wouter Wolters +1
- Helmut Hummel +1
-
Verified V +2 Done
- Benni Mack +2
- Oliver Klee +1
- Helmut Hummel +1
- core-ci +1 CI
Issues 1
Files 5
- Build/tests/playwright/e2e/toolbar/backend-logo.spec.ts3new+83 −0
- typo3/sysext/backend/Classes/Controller/BackendController.php+31 −20
- typo3/sysext/backend/Tests/Functional/Controller/BackendControllerTest.php+99 −1
- typo3/sysext/backend/Tests/Functional/Fixtures/Extensions/test_backend_logo/Resources/Public/Images/logo@2x.pngnewbinary
- typo3/sysext/backend/Tests/Functional/Fixtures/Extensions/test_backend_logo/composer.jsonnew+16 −0
Review log 2533
Show 68 earlier messages
-
Wouter Wolters uploaded patch set 1 08/14/26, 18:24
-
core-ci voted on patch set 1 V +1 08/14/26, 18:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106710
-
Simon Schaufelberger voted on patch set 1 CR +1 V +1 08/15/26, 12:36
-
Stefan Bürk commented on patch set 1 CR -1 08/15/26, 15:22
Thanks for tackling this. The direction — resolving the backend logo through the System Resource API instead of going through an absolute file system path — is right and should be kept. Three points block the change in its current form, though. I'm working on it and will push modified patch sets (plus a follow-up change on top) later, so no action needed from your side for now. 1) The deprecation removal is a breaking change and must not be backported The change replaces the E_USER_DEPRECATED in ExtensionManagementUtility::resolvePackagePath() with a thrown InvalidSystemResourceIdentifierException. GeneralUtility::getFileAbsFileName() catches that exception and returns an empty string, so every PKG: identifier passed through it stops resolving: Fluid template root paths, XLIFF label files, TypoScript/TSconfig file includes, TCA icon paths and so on. Some version archaeology on the milestone mentioned in the forge issue: * 5d637429cff (#107537) introduced the System Resource API and the PKG: syntax, pushed with "Releases: main" while main was 14.0.0-dev * 1410751ee83 (#107907) added the deprecation, also "Releases: main" at 14.0.0-dev Both therefore shipped in v14.0.0. main is 15.0.0-dev today and the LTS branch is 14.3, so "will be removed in TYPO3 v14 LTS" named a milestone that has already been released. Something deprecated in v14.0 can only be removed in v15. Additionally there is no Deprecation changelog for #107907 anywhere in typo3/sysext/core/Documentation/Changelog/ — the trigger_error() was added undocumented. So the resolvePackagePath() part, and the GeneralUtilityTest data set "PKG paths are no longer resolved to absolute paths" belonging to it, need to move into a separate [!!!] change for main only, with a Breaking rst in Changelog/15.0/. I'll push that as a relation chain on top of this one. 2) A configured but missing logo file no longer falls back SystemResourceFactory::createPublicResource() validates the identifier syntax, the package existence and whether the relative path is a public path. It does not check that the file exists — see SystemResourceIdentifierFactory::getPackageAndValidatePath() and PublicPackageFile::isPublished(). DefaultSystemResourceUriGenerator returns a URI for a non-existing file as well; CacheBustingUri::fromFileSystemPath() merely skips the cache busting query argument. The new code assigns $logoUrl before calling getContents(), so when getContents() throws SystemResourceDoesNotExistException the catch swallows it while $logoUrl is already set, and the "if ($logoUrl === '')" fallback never triggers. The removed file_exists() guard was doing that job. Measured against BackendController::mainAction() on sqlite: * backendLogo = EXT:backend/Resources/Public/Images/does_not_exist.svg before: typo3_logo_orange.svg 22x22 now: a broken image tag pointing at does_not_exist.svg * backendLogo = PKG:typo3/cms-backend:Resources/Public/Images/does_not_exist.svg same result The working cases behave identically to before, and the PKG: deprecation is indeed gone — that part works as intended. Reading the contents first and assigning $logoUrl only after the resource proved readable restores the old behaviour. 3) An extensionless logo file kills the backend PackageResource::getExtension() returns PathUtility::pathinfo(...)['extension'] without a null coalesce, and pathinfo() omits that key for a file without a suffix. Pointing backendLogo at an existing file without an extension gives: TypeError: PackageResource::getExtension(): Return value must be of type string, null returned typo3/sysext/core/Classes/SystemResource/Type/PackageResource.php:51 A TypeError is not a SystemResourceException, so the catch does not apply and the whole backend answers with a 500. Before this change the same configuration rendered fine with the 22x22 defaults. Checking the name instead of the extension avoids the problem here. The getExtension() return type violation itself is a defect of the resource API and deserves its own issue and change for main and 14.3. Minor points * "if ($resource instanceof SystemResourceInterface)" reads as redundant but is not: PublicResourceInterface does not extend SystemResourceInterface, and UriResource — an "https://..." logo — implements only the former. That guard is what keeps a URL logo on the fallback path. A short comment would help the next reader. * The empty catch deserves a comment stating the fallback intent. * SvgDocumentService::getDimensions() falls back to 64x64 when an SVG carries neither a viewBox nor numeric width/height attributes, where ImageInfo previously yielded nothing and the 22x22 defaults were kept. Acceptable, but an undocumented behaviour change. * Four added constructor arguments on BackendController, which is a readonly class, neither final nor internal. For 14.3.x patch releases that is an ArgumentCountError for any subclass calling parent::__construct(). Core practice tolerates this for controllers, but it is worth a conscious decision for the backport. * The error suppression operator on getimagesizefromstring() can go, the false return value is checked anyway. * Test coverage of the rewritten dimension handling is thin. Only "PKG identifier is accepted" is covered; the missing file fallback, SVG dimensions, raster dimensions and the "@2x" halving are not. I'll extend the functional tests and add a Playwright e2e test that drives the ext conf through the install tool settings modal and asserts the topbar image really loads, since a plain src assertion would not have caught point 2. Voting -1 to keep this from being merged as is. I'll take it from here and push the updated patch set together with the follow-up change. -
Stefan Bürk uploaded patch set 2
CR +1V +108/15/26, 16:23 -
Stefan Bürk commented on patch set 2 08/15/26, 16:30
Patch set 2, as announced. The breaking part is extracted into a follow-up on top of this change: https://review.typo3.org/c/Packages/TYPO3.CMS/+/95342 What changed here compared to patch set 1: * ExtensionManagementUtility::resolvePackagePath() and the GeneralUtilityTest data set belonging to it moved to 95342, so this change stays backportable to 14.3. * The URI is generated only after getContents() proved the resource readable. Before, a configured but missing file rendered a broken image instead of falling back to the default TYPO3 logo, because a URI is generated for a non-existing resource as well. * The SVG branch checks the resource name instead of calling getExtension(), which violates its "string" return type for a file without a suffix and took the whole backend down with a TypeError. * Empty contents are skipped, so getimagesizefromstring() no longer needs the error suppression operator. * Functional coverage extended to twelve cases: EXT and PKG for SVG and raster images, the "@2x" halving through a new test_backend_logo fixture extension, a leading slash, and the fallback for a missing file, an unknown package, a URL, a garbage string and no configuration at all. failOnDeprecation in the functional suite makes the PKG cases guard the deprecation regression by themselves. * New e2e test Build/tests/playwright/e2e/toolbar/backend-logo.spec.ts. It configures backendLogo through the install tool settings modal and asserts the rendered image plus naturalWidth greater than zero, which a plain "src" assertion would not catch. Still open from my earlier comment, deliberately not addressed here: the getExtension() return type violation deserves its own issue and change for main and 14.3, and the four added constructor arguments on BackendController are an ArgumentCountError for subclasses in a 14.3 patch release. Happy to hear opinions on the latter. Green locally: cgl, checkIntegrityPhp, phpstan, checkRst, checkExtensionScannerRst, lintTypescript, the unit tests, the functional tests on sqlite and mariadb, and the new e2e test. -
core-ci voted on patch set 2 V +1 08/15/26, 16:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106764
-
Oliver Klee updated the commit message in patch set 3
V +108/17/26, 07:57
-
Oliver Klee voted on patch set 3 CR +1 V +1 08/17/26, 07:58
-
core-ci voted on patch set 3 V +1 08/17/26, 08:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106807
-
Helmut Hummel commented on patch set 3 CR -1 08/20/26, 14:36
looking into it -
Helmut Hummel commented on patch set 3 08/22/26, 07:56
> The URI is generated only after getContents() proved the resource readable. Before, a configured but missing file rendered a broken image instead of falling back to the default TYPO3 logo, because a URI is generated for a non-existing resource as well. Is this the behaviour we really want in the future? I would argue, that as integrator, I would rather expect an error to be shown when configuring a wrong path, than silently ignoring the config. -
Helmut Hummel commented on patch set 3 08/22/26, 08:08
> TypeError: PackageResource::getExtension(): Return value must be of type string, null returned That is a great catch and must be fixed in `\TYPO3\CMS\Core\SystemResource\Type\PackageResource::getExtension` to fall back to empty string, equivalent to `\TYPO3\CMS\Core\Resource\AbstractFile::getExtension` -
Helmut Hummel commented on patch set 3 08/22/26, 17:45
backend-logo.spec.ts:47To me this looks like a big overhead, to simply set a configuration for a test. it also binds this task to the currently implemented UI -
Helmut Hummel commented on patch set 3 08/22/26, 17:49
At least for main, I would prefer to first implement: https://review.typo3.org/c/Packages/TYPO3.CMS/+/95385 These added methods will for sure be useful in other places and abstract the nitty gritty details of image type detection into the system resource API, where it belongs, instead of rather leaking that on every usage of the new API I think it also makes sense to backport this to v14, although it introduces new API methods which could be seen as feature -
Helmut Hummel uploaded patch set 4
CR +1V +108/23/26, 08:10 -
core-ci voted on patch set 4 V -1 08/23/26, 08:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106985
-
Helmut Hummel uploaded patch set 5
V -108/23/26, 09:34 -
Helmut Hummel uploaded patch set 6 08/23/26, 09:40
-
core-ci voted on patch set 5 V +1 08/23/26, 09:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106986
-
core-ci voted on patch set 6 V +1 08/23/26, 09:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/106987
-
Helmut Hummel commented on patch set 6 08/23/26, 09:56
here is my suggestion of how it can look like with extended API. of course the underlying change must go in first for that. what do you think?backend-logo.spec.ts:47Replynot a blocker for me though -
Helmut Hummel rebased onto patch set 7
V +108/28/26, 07:45 -
core-ci voted on patch set 7 V +1 08/28/26, 07:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107319
-
Helmut Hummel uploaded patch set 8 08/28/26, 09:20
Copied Votes: * Verified+1 (copy condition: "**changekind:NO_CHANGE**") -
core-ci voted on patch set 8 V +1 08/28/26, 09:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/107324
-
Wouter Wolters voted on patch set 8 CR +1 08/28/26, 09:39
-
Helmut Hummel commented on patch set 6 08/28/26, 10:24
backend-logo.spec.ts:47Replyfine with me -
Helmut Hummel commented on patch set 8 08/28/26, 10:24
Reply
done -
Helmut Hummel voted on patch set 8 CR +1 V +1 08/28/26, 10:24
-
Oliver Klee voted on patch set 8 CR +1 V +1 08/31/26, 08:18
-
Benni Mack voted on patch set 8 CR +2 V +2 08/31/26, 20:48
-
Benni Mack merged patch set 9 08/31/26, 20:48