Problem/Motivation

Certain URL's such as admin/structure/block return unexpected errors due to PHP TypeError's in function preprocessAggregatorContainer of zeropoint/src/Hook/ZeropointHooks.php.

Steps to reproduce

On Drupal 11.4.9, navigate to https://example.com/admin/structure/block.

The client shows: "The website encountered an unexpected error. Try again later."

Watchdog reports:

24366 13/Oct 23:01 php Error TypeError: in_array(): Argument #2 ($haystack) must be of type
array, string given in in_array() (line 1221 of
/var/www/drupal/themes/contrib/zeropoint/src/Hook/ZeropointHooks.p
hp).

Proposed resolution

Cast to an array when assigning classes.
$classes = (array) ($variables['element']['#attributes']['class'] ?? []);

(...or track down the guilty party who put a singleton object in there, and convince them to repent of the evil of their ways.)

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork zeropoint-3630998

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tbroberg created an issue. See original summary.

adityarawat_ln’s picture

Assigned: Unassigned » adityarawat_ln

adityarawat_ln’s picture

Assigned: adityarawat_ln » Unassigned
Status: Active » Needs review

I reproduced the reported TypeError on Drupal 11.4.9 using the Zero Point 2.0.0 theme.

I updated `preprocessAggregatorContainer()` in `ZeropointHooks.php` to cast the class attribute to an array before passing it to `in_array()`.

After clearing Drupal's cache, I verified that `/admin/structure/block` loads without the reported TypeError.

I've opened a merge request targeting the `2.0.x` branch with the fix for review:

  • florian committed 0046c174 on 2.0.x
    - Fixed stored XSS vulnerabilities involving menu icon titles and...
florian’s picture

Status: Needs review » Fixed

Thanks @adityarawat_ln,
The bug was fixed in 2.0.1 release.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

florian’s picture

Status: Fixed » Closed (fixed)
florian’s picture

Assigned: Unassigned » florian