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