Problem/Motivation
When trying to edit an invite type, the user is confronted with a fatal error: The website encountered an unexpected error. Please try again later.
In the logs I found the following corresponding error; TypeError: explode(): Argument #2 ($string) must be of type string, Drupal\Core\Config\ImmutableConfig given in explode() (line 91 of /app/www/modules/contrib/invite/src/Form/InviteTypeForm.php)
Steps to reproduce
Go to Settings > People > Invite > Invite Settings > Invite List Type (/admin/structure/invite_type), and edit existing invite type.
Comments
Comment #4
tijsdeboeckComment #6
tijsdeboeckUpdated my merge request
Comment #7
tijsdeboeckComment #8
dale42Code review
- The patch works
- Correctly identified the changes in #3276084: Fix all dependency injection in the Invite as the source of the issue
- Undid the specific change causing the issue
Proposed improvement
There were a couple of issues with changes in #3276084:
configFactory. There is a method namedconfigFactoryonFormBase. The new code used the method inherited fromFormBase,$this->configFactory(), not the attribute it created to hold the service object,$this->configFactory.config.factory, it could have directly called$this->configFactory().I don't think we should still use dependancy injection. I propose changing the existing MR by replacing the
\Drupal::configcall with$this->configFactory():Comment #9
dale42Opps, I think I was looking at MR 11 instead of MR 12.
So, what I propose is:
Comment #10
dale42@tijsdeboeck: I didn't want to update your MR directly, that seems rude.
Attached is a patch with the changes I mentioned. It also includes removing the dependency injection for messenger. It turns out that, like config factory, one of the parent classes already includes it.
The patch:
->configFactory()method->messenger()method->configFactory()callComment #11
tijsdeboeckHi @dale42, thanks for the patch! I didn't have time to look at your previous comments, and I really don't mind anyone changing my MR's ;)
I just tried it out patch #10, and it works perfectly! 👍