- Issue created by @yas
- last update
over 1 year ago 29,388 pass - Status changed to Needs review
over 1 year ago 5:07am 16 May 2023 - 🇺🇸United States yas California 🇺🇸
We can simply add a Null coalescing operator like:
'#default_value' => in_array($perm, $role_permissions[$rid] ?? []) ? 1 : 0,
But I put
!empty($role_permissions[$rid]) ? $role_permissions[$rid] : []
since we should consider the case of an empty string. - 🇺🇸United States yas California 🇺🇸
@cilefen
My team member who is new to Drupal accidentally put
Permissions: NULL
inuser.role.authenticated.yml
and imported it to a site. Drupal experts won't be likely to do that because we all know about Drupal; however on the other hand someone will possibly do the same in the future. It was something like a manual negative test and we found a kind of bug of Drupal core which expects a valid input data. We should make Drupal core more robust. - Status changed to Needs work
over 1 year ago 11:37am 16 May 2023 We have had many workaround patches like this offered now that PHP 8 is in use.
It would actually be better to throw an exception for a wrong data type than to silently allow it.
- 🇬🇧United Kingdom andrew.farquharson
andrew.farquharson → made their first commit to this issue’s fork.
- last update
over 1 year ago 29,364 pass, 4 fail - @andrewfarquharson opened merge request.
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Custom Commands Failed - First commit to issue fork.
- last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,388 pass, 1 fail - last update
over 1 year ago 29,420 pass - Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - @andrewfarquharson opened merge request.
- Status changed to Needs review
over 1 year ago 5:53pm 11 June 2023 - 🇬🇧United Kingdom andrew.farquharson
The Unit test does not seem necessary. Manual testing seems the simplest method. Just manually edit the user.role.authenticated.yml file and set 'permissions: NULL'. Then access the admin permissions form and refer to 'recent log messages' under admin/reports and look for the InvalidArgument Exception message. No errors should be generated.
- Status changed to Needs work
over 1 year ago 6:05pm 11 June 2023 - Open on Drupal.org →Environment: PHP 8.2 & MySQL 8last update
over 1 year ago Not currently mergeable. - last update
over 1 year ago 29,425 pass, 1 fail - 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin
@cilefen #6 🐛 TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() in Drupal\user\Form\UserPermissionsForm Needs work yeah I can't find them at this very moment but we had some of this issues lately and discussed many of it in Slack with the same conclusion: it would be better to handle it with an exception and a log to prevent WSOD but without let it pass silently so that admin know that there is sth to fix.
- 🇮🇳India ameymudras
Do we really need to fix this issue? user.role.authenticated.yml should always be system generated as opposed to making manual changes.
- 🇳🇴Norway svenryen
This patch probably won't make it into core, due to the lack of a test.
I'm adding it here, since we saw additional fatal crashes in another file where in_array() was being used on a NULL value, and it might help others facing the same bug.