Problem/Motivation
Use Dependency Injection to provide the appropriate object to the Service.
Steps to reproduce
Install this module Hook Events Dispatcher
An error is thrown when the content is using Lazy Load module:
See log file attached "Lazy_Hook_Event_Dispatcher_issue.txt"
Proposed resolution
Replace Class moduleHandler with its Interface moduleHandlerInterface.
Remaining tasks
User interface changes
N/A
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | lazy-typehint_mopdulehandler-3308141-12.patch | 1.43 KB | kaloyan.damyanov |
| #9 | 3308141-lazy.diff | 1.49 KB | rhip |
| Lazy_Hook_Event_Dispatcher_issue.txt | 7.92 KB | rodetrev |
Issue fork lazy-3308141
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rodetrev commentedComment #5
dieterholvoet commentedI pushed a fix to the MR. Without this fix, sites running the latest version of Hook Event Dispatcher are completely broken.
Comment #6
dpiMany people are seeing errors related to ModuleHandler as a result of upgrading Hook Event Dispatcher, which includes a module handler service decorator.
Projects need to ensure interfaces are used while injecting services, so this project will need to make the code change here.
Comment #7
dpiComment #8
dieterholvoet commentedAny update? This is breaking sites left and right.
Comment #9
rhip commentedUploading a diff file of the patch created in the Issue Fork (for security reasons).
Comment #10
dieterholvoet commentedComment #11
blainelang commentedWSOD after updating from 9.4.8 to 9.5
"NOTICE: PHP message: TypeError: Drupal\lazy\Lazy::__construct(): Argument #5 ($module_handler) must be of type Drupal\Core\Extension\ModuleHandler, Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 263 in /var/www/html/web/modules/composer/lazy/src/Lazy.php on line 67 #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(263): Drupal\lazy\Lazy->__construct(Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\Http\RequestStack), Object(Drupal\Core\Condition\ConditionManager), Object(Drupal\Core\Routing\AdminContext), Object(Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler))"Was able to create a patch and apply using composer - thanks @rodetrev
Would be nice to see this rolled into an update.
Comment #12
kaloyan.damyanov commented+1
Comment #14
dieterholvoet commented@osman any chance you can create a new release with this and Drupal 10 support? Also, don't forget to mark this issue as Fixed.
Comment #15
leolandotan commentedI have tested this with the patch in #12 on Drupal core 9.4.12 and Lazy-load 8.3.11. The error causing the WSOD is now gone.
Comment #16
blainelang commentedShould we close this issue if the patch has already been committed and version 3.12.0 released?
Comment #17
dieterholvoet commented