ColdTrick / event_manager

Manage events in Elgg
https://elgg.org/plugins/736695
27 stars 37 forks source link

Plugin v19.0 not working in Elgg 6.x #188

Closed rohit1290 closed 1 month ago

rohit1290 commented 1 month ago

Elgg version v6.0.1

Plugin version v19.0

Plugin source

Describe the bug Installed a fresh copy of elgg 6.0.1, install a fresh copy of event_manager v19.0. After activating the plugin, go to the activity page or blog page, etc. Getting the following error:

[20-Jul-2024 19:22:26 Asia/Kolkata] [2024-07-20T19:22:26+05:30] ELGG.CRITICAL: Exception at time 1721483546:
ColdTrick\EventManager\Menus\Site::registerEvents(): Return value must be of type Elgg\Menu\MenuItems, array returned
  {"backtrace":[],"process_id":7756,"memory_peak_usage":"26 MB","memory_usage":"26 MB","url":"/www/elgg6/blog","ip":"::1","http_method":"GET","server":"localhost","referrer":null,"unique_id":"ZpvBE-0tB-lmitGCZ2aLggAAAAU"}
jdalsem commented 1 month ago

This problem is not caused by the event manager plugin. Another plugin is returning an array in the 'register', 'menu:site' event.

Event manager is only being strict about the return type (MenuItems class). $event->getValue() is not what we expect. If you disable the event manager you should be able to inspect which plugins have registered for this event (with the developer tools -> inspect events). One of these plugins is returning an array instead of a MenuItems