Replies: 2 comments
|
You can go about this 2 different ways.
<?php
use Phalcon\Events\Event;
use Phalcon\Events\Manager;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Mvc\Dispatcher\Exception as DispatchException;
$container->setShared('dispatcher', function () {
$eventsManager = new Manager();
$eventsManager->attach(
'dispatch:beforeException',
function (Event $event, Dispatcher $dispatcher, \Exception $exception) {
if ($exception instanceof DispatchException) {
switch ($exception->getCode()) {
case DispatchException::EXCEPTION_HANDLER_NOT_FOUND:
case DispatchException::EXCEPTION_ACTION_NOT_FOUND:
$dispatcher->forward([
'controller' => 'errors',
'action' => 'show404',
]);
return false;
}
}
}
);
$dispatcher = new Dispatcher();
$dispatcher->setDefaultNamespace('MBB\Controllers');
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});When the listener returns
|
0 replies
|
Thank You! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
is there a possibility to remove such entries from the logfile:
[Wed Nov 18 14:01:01.845286 2026] [php:notice] [pid ...] [client ...] MBB\\Controllers\\AdministratorController handler class cannot be loaded\n#0 [internal function]: Phalcon\\Mvc\\Dispatcher->throwDispatchException()\n#1 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->dispatch()\n#2 /var/www/intern.muldenblechbande.de/public/index.php(73): Phalcon\\Mvc\\Application->handle()\n#3 {main}[Wed Nov 18 14:01:02.094246 2026] [php:notice] [pid ...] [client ...] MBB\\Controllers\\CoreController handler class cannot be loaded\n#0 [internal function]: Phalcon\\Mvc\\Dispatcher->throwDispatchException()\n#1 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->dispatch()\n#2 /var/www/intern.muldenblechbande.de/public/index.php(73): Phalcon\\Mvc\\Application->handle()\n#3 {main}[Wed Nov 18 14:01:02.342844 2026] [php:notice] [pid ...] [client ...] MBB\\Controllers\\IncludesController handler class cannot be loaded\n#0 [internal function]: Phalcon\\Mvc\\Dispatcher->throwDispatchException()\n#1 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->dispatch()\n#2 /var/www/intern.muldenblechbande.de/public/index.php(73): Phalcon\\Mvc\\Application->handle()\n#3 {main}[Wed Nov 18 15:37:19.931033 2026] [php:notice] [pid ...] [client ...] MBB\\Controllers\\ApiController handler class cannot be loaded\n#0 [internal function]: Phalcon\\Mvc\\Dispatcher->throwDispatchException()\n#1 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->dispatch()\n#2 /var/www/intern.muldenblechbande.de/public/index.php(73): Phalcon\\Mvc\\Application->handle()\n#3 {main}They are spamming the logfile, because somebody is trying different non-existent URLs on our website.
I know how to remove notices, but I only want to remove these
handler class cannot be loadedmessages.TIA, Nico
All reactions