Bug #106200
openIconFactory returns modified icons
0%
Description
I as an API user would expect a proper Icon
instance from the IconFactory
.
But the IconFactory
does not return the pure icon. It keeps an internal cache with references. The returned icons can be modified later through their setter. This might be useful if one would add an title or re use an icon but make it spinning.
The issue is that those are setters. Instead, a clone should be returned. Maybe `with` instead of `set` methods should exist.
This can also happen when using <core:icon title="Open actions menu" identifier="actions-menu" />
. That way also integrators might run into those issues. As it is not clear that the `title` attribute will modify the system state of the used icon.
Steps to reproduce:
- Fetch an icon by its identifier in context a and render it
- Fetch an icon by the same identifier as in step 1, modify the returned icon, e.g. make it spinning or set a title and render it
- Fetch an icon by the same identifier as in step 1. It will be rendered with modifications from 2nd step.
The issue occurs in v12 and v13.
Updated by Daniel Siepmann 25 days ago
ยท Edited
I've pushed a Patch to demonstrate the brokenness: https://review.typo3.org/c/Packages/TYPO3.CMS/+/88263
Updated by Daniel Siepmann 18 days ago
TYPO3 uses the ->setTitle()
within the Page Module for the header of each grid column item: https://github.com/TYPO3/typo3/blob/4cd98f3fa5ca9b2f5bc48c1acb74faacaf583c7f/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php#L192
That way using the same icons in a preview will result in unexpected output.