We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Dispatcher and beforeExecuteRoute - extraordinary effects

Hi again. According to that: https://olddocs.phalcon.io/en/3.0.0/reference/tutorial-invo-2.html and that: https://olddocs.phalcon.io/en/3.0.0/api/Phalcon_Mvc_Dispatcher.html I added to services.php:

        function () {
            $dispatcher = new \Phalcon\Mvc\Dispatcher();
                $eventsManager = new \Phalcon\Events\Manager();
                    new SecurityService()

            return $dispatcher;

And of course my implementation in service:

   public function beforeExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Dispatcher $dispatcher)
        $router = new \Phalcon\Mvc\Router();

        if ($router->wasMatched()) {
            //it performs well, according to my expectations
             file_put_contents('test1.txt', 'Well done!');
        //this is sth extraterrestrial !!!
            file_put_contents('test2.txt', 'Phalcon secret parser here');

            echo 'I am in (|)';

Of course I call /index/test action by URL (to ensure that effect occurs at least 5 times, sometimes works in first time, I don't know why)

Could someone tell me, why both files apear when I call /index/test? How can I code when basic control structures don't work?


Favicon request?


Good point!

Browser always sends a request like /favicon.ico even if I don't have anything in head.