Describe the bug
If we have two listeners "dispatch:beforeExecuteRoute" and first listener "return false" and second listener don't "return false" then dispatcher don't stop.
In documentation is written:
"If we do not have access, then the method will return false stopping the execution, right after we forward the user to the home page."
(https://docs.phalcon.io/4.0/en/tutorial-invo)
To Reproduce
$container->set(
'dispatcher',
function () {
$eventsManager = new Manager();
$eventsManager->attach(
'dispatch:beforeExecuteRoute',
new SecurityPlugin()
);
$eventsManager->attach(
'dispatch:beforeException',
new NotFoundPlugin()
);
$containerspatcher = new Dispatcher();
$containerspatcher->setEventsManager($eventsManager);
return $containerspatcher;
}
);
class SecurityPlugin extends Injectable
{
public function beforeExecuteRoute(
Event $event,
Dispatcher $containerspatcher
) {
return false;
}
}
class NotFoundPlugin extends Injectable
{
public function beforeExecuteRoute(
Event $event,
Dispatcher $containerspatcher
) {
// different than false
return true;
}
}
Expected behavior
Follow documentation "return false" should stop dispatcher.
Details
- Phalcon version: 4.0.0 (also 3.4.1)
- PHP Version: 7.4 (7.2)
- Operating System: Linux Debian
- Installation type: Compiling from source in Docker
- Server: Nginx
- Other related info (Database, table schema): MySQL 5.5
Describe the bug
If we have two listeners "dispatch:beforeExecuteRoute" and first listener "return false" and second listener don't "return false" then dispatcher don't stop.
In documentation is written:
"If we do not have access, then the method will return false stopping the execution, right after we forward the user to the home page."
(https://docs.phalcon.io/4.0/en/tutorial-invo)
To Reproduce
Expected behavior
Follow documentation "return false" should stop dispatcher.
Details