Skip to content

SuiteInitSubscriberTrait incorrectly appends 'receiveModuleContainer' listener #6861

@dantleech

Description

@dantleech

Hi

The SuiteInitSubscrtiberTrait was introduced recently in:

https://github.com/Codeception/Codeception/pull/6851/files#diff-4cd87484550c33eba1e84bdee7530fca0a946ea5c25de6a085e3d30f534d70cdL47

But it incorrectly appends the listener so that any extension listening suite.init causes:

[26-May-2025 06:38:58 UTC] PHP Fatal error:  Uncaught TypeError: Symfony\Component\EventDispatcher\EventDispatcher::addListener(): Argument #3 ($priority) must be of type int, string given, called in /data/vendor/symfony/event-dispatcher/EventDispatcher.php on line 178 and defined in /data/vendor/symfony/event-dispatcher/EventDispatcher.php:129

This is because Symfony expects one of:

'suite.init' => 'methodName',
'suite.init' => [
   'methodName'
]
'suite.init' => [
    ['methodName', 10], // listener priorirty
]

The new code assumes 2 but appends and appends to the array:

'suite.init' => [
    'methodName',
    'receiveModuleContainer',
],

And Symfony tries to use receiveModuleContainer as a priotity (as with 3) causing the error above. Currently there is no way to listen on suite.init.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions