Project

General

Profile

Actions

Bug #106200

open

IconFactory returns modified icons

Added by Daniel Siepmann 25 days ago. Updated 18 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2025-02-18
Due date:
% Done:

0%

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

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:

  1. Fetch an icon by its identifier in context a and render it
  2. 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
  3. 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.

Actions #1

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

Actions #2

Updated by Daniel Siepmann 25 days ago

  • Description updated (diff)
Actions #3

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.

Actions

Also available in: Atom PDF