- Issue created by @idiaz.roncero
- Status changed to Needs work
over 1 year ago 10:52am 30 May 2023 - πͺπΈSpain idiaz.roncero Madrid
For those in need of a quick workaround, I've created a MR that simply bypasses the code when there is no Role loaded.
This is clearly NOT the final solution, as it will result on divergent results (i.e: after a
drush site-install --existing-config
your permissions might be different as hook_install won't be executed!)This is just a workaround for those that need to have a temporary solution. I keep the issue as "Needs work"
- π©π°Denmark ressa Copenhagen
I got this error, after installing a minimal install and then running
drush site:install --existing-config -y
as shared by Philip Norton in Drupal 8: Install Site From Existing Configuration in Drupal 10.1.[error] Error: Call to a member function grantPermission() on null in matomo_install() (line 19 of /var/www/html/web/modules/contrib/matomo/matomo.install) #0 [internal function]: matomo_install(true)
As a temporary workaround I also commented out those lines during the install + import of config, after which it completed.
- π©π°Denmark ressa Copenhagen
This breaks deployment, so upping Priority.
- Assigned to Grimreaper
- Assigned to shelane
- π«π·France Grimreaper France π«π·
Hi,
After trying to update one of my website on Drupal 10.1 and reinstalling I also get this issue. And a similar issue for other contrib modules (Fontawesome).
Thanks for the MR. Attaching a patch file from it for Composer usage.
I agree that this is only a workaround and not a final solution. I currently do not have the time to search for a definitive solution.
Maybe switch to hook_modules_installed? adding a dependency on the user module (I tried that for Fontawesome, and it was not a success or I tested too quickly)?
I am in favor of merging and making a new release to unblock people.
@shelane, what do you think?
- π¨π¦Canada rosiel
In a similar issue on a different module, @neclimdul proposed using a helper function,
user_role_grant_permissions
. See https://www.drupal.org/project/userprotect/issues/3349663#comment-15104566 π Error: Call to a member function grantPermission() on null in userprotect_install() RTBC - π³π±Netherlands seanB Netherlands
In #3349663-7: Error: Call to a member function grantPermission() on null in userprotect_install() β neclimdul found out what is happening. In short, this is caused by the change in π Remove special case of User module install Fixed . Modules are installed first and the default config for the modules is imported later. Since the authenticated user role is default config of the user module, the role doesn't exist yet in the install hook of other modules.
We can add the permissions using
user_role_grant_permissions()
which is also used in core bymedia_install()
andnode_install()
. It basically uses the same checks, so we don't have to duplicate that code. We should probably also add a check for the user module existance (or add a dependency on the user module, but that seems a bit silly).Since this only seems to happen when installing sites from existing config, it shouldn't really matter that the module install hook can't add the permissions to the authenticated user role.
- Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - Issue was unassigned.
- Status changed to Needs review
over 1 year ago 4:15pm 11 September 2023 - Open on Drupal.org βCore: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7last update
over 1 year ago Waiting for branch to pass - π«π·France Grimreaper France π«π·
Hi,
Thanks @seanB for the explanations and suggestions.
I have updated the MR.
If people are ok with it I will merge and create a new release when I will have time.
- πΈπͺSweden emek
We have tried a patch with the latest changes in the MR and now installation works for us.
- Status changed to RTBC
about 1 year ago 10:20am 13 November 2023 - π¨πSwitzerland bircher π¨πΏ
We are using a patch created from this MR (at the time of writing d74c9750)
This can be merged for what I can tell. - π©π°Denmark ressa Copenhagen
Thanks for the patch, it works well and fixes the bug, and can be rolled out.
- Assigned to Grimreaper
- Open on Drupal.org βCore: 10.1.4 + Environment: PHP 8.1 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass -
Grimreaper β
committed cfb2c74d on 8.x-1.x authored by
idiaz.roncero β
Issue #3363521 by Grimreaper, idiaz.roncero, ressa, rosiel, seanB,...
-
Grimreaper β
committed cfb2c74d on 8.x-1.x authored by
idiaz.roncero β
-
Grimreaper β
committed 0b046117 on 2.0.x authored by
idiaz.roncero β
Issue #3363521 by Grimreaper, idiaz.roncero, ressa, rosiel, seanB,...
-
Grimreaper β
committed 0b046117 on 2.0.x authored by
idiaz.roncero β
- Issue was unassigned.
- Status changed to Fixed
about 1 year ago 6:13pm 25 November 2023 - π«π·France Grimreaper France π«π·
Hi,
Merged manually on 8.x-1.x because of Gitlab CI workflow not ok. I guess due to dependency on PHP module.
Cherry-picked on 2.0.x.
Creating a new release for 8.x-1.x
- π©π°Denmark ressa Copenhagen
Thanks for the new release, it's always nice to have one less patch file and entry in composer.json to juggle with :)
Automatically closed - issue fixed for 2 weeks with no activity.