Issue Bug Closed

#106492Preview Simulator sets fe_user usergroup with wrong type

Hannes Lau 04/02/25, 10:53 updated 12/02/25, 14:22

Description

A third party extension uses this line to get the list of direct usergroup uids of the current fe user.

```
declare(strict_types=1);
…
explode(‘,’, $GLOBALS[‘TSFE’]->fe_user->user[‘usergroup’] ?? ‘’);
```

If the usergroup is simulated via query parameter `?ADMCMD_simUser=2`, the preview simulator sets the usergroup as an int (not as string (csv)). Therefore explode gets an int as the second argument, but expects a string.

I am aware this can be fixed with a type cast but I think for most developers it is reasonable to assume that `user[‘usergroup’]` contains a string.

Reviews 2

History 37

  1. Hannes Lau commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-04-02T17:10:08+00:00" > 04/02/25, 17:10 </span>

    Applied in changeset commit:fcd5e080f9fc047acc09c15db163ae3c845f719c.