Skip to content

Fix multiple listeners on command:beforeCommand event not stopping dispatch#4

Open
ChristopheMayet wants to merge 1 commit intoSachaMorard:masterfrom
ChristopheMayet:fix/before-command-event
Open

Fix multiple listeners on command:beforeCommand event not stopping dispatch#4
ChristopheMayet wants to merge 1 commit intoSachaMorard:masterfrom
ChristopheMayet:fix/before-command-event

Conversation

@ChristopheMayet
Copy link

Hi Sacha,

I found a bug in the execution of events in this line of Script class.

Here the $this->_eventsManager->fire('command:beforeCommand', $command) call will return true (the last listener call) and then will not stop the command execution if multiple instance listn to this same event.

To reproduce :

  • Define two event listeners attached to the event command
  • Define beforeCommand method on both
  • Return false on the first listener (with higher priority)
  • Return true for the second listener
  • Run a phalcon command

The execution is not stopped while one of listener returned false.

This PR adresses this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant