Skip to content

Icons cannot be selected in dev environment #8021

@MarkusHolstein

Description

@MarkusHolstein
Q A
Sulu Version 2.6.9
PHP Version 8.3.17
DB Version unrelated
Browser Version unrelated

Actual Behavior

When using the single_icon_selection with the shipped Icomoon-Provider in dev environment, a warning is emmitted, which is turned into an exception and no icons are shown:

request.CRITICAL: Uncaught PHP Exception ErrorException: "Warning: Undefined array key 0" at IcomoonProvider.php line 53 {"exception":"[object] (ErrorException(code: 0): Warning: Undefined array key 0 at /var/www/html/vendor/sulu/sulu/src/Sulu/Bundle/AdminBundle/Icon/providers/IcomoonProvider.php:53)"} []

Expected Behavior

The icons should be displayed, even if the value is not correctly filled in the json-file and no warning should be thrown

Steps to Reproduce

  • Add single_icon_selection with icon_set "sulu" to a template
  • Open the backend
  • Click on the icon selection

Possible Solutions

Replace in file src/Sulu/Bundle/AdminBundle/Icon/providers/IcomoonProvider.php::53

 - $attrs = $icon->icon->attrs[$index];
 + $attrs = $icon->icon->attrs[$index] ?? new \stdClass();

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugError or unexpected behavior of already existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions