-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Steps to reproduce the issue
- Set up a standard Joomla 5.x installation.
- In Global Configuration -> Logging, enable logging to capture errors.
- Navigate to any URL on the frontend that does not exist.
Expected result
The website should display the template's standard 404 error page (error.php
). The server should return a 404 HTTP status code, and no "CRITICAL
" error should be logged for a simple page not found event.
Actual result
A "CRITICAL" error is logged, and the user may be presented with a generic server error page instead of the themed 404 page.
Log Entry:
2025-07-25T15:17:44+00:00 CRITICAL ::1 error Uncaught Throwable of type Joomla\CMS\Router\Exception\RouteNotFoundException thrown with message "Seite nicht gefunden". Stack trace: #0 [ROOT]\libraries\src\Application\SiteApplication.php(767): Joomla\CMS\Router\Router->parse(Object(Joomla\CMS\Uri\Uri), true)
#1 [ROOT]\libraries\src\Application\SiteApplication.php(243): Joomla\CMS\Application\SiteApplication->route()
#2 [ROOT]\libraries\src\Application\CMSApplication.php(304): Joomla\CMS\Application\SiteApplication->doExecute()
#3 [ROOT]\includes\app.php(58): Joomla\CMS\Application\CMSApplication->execute()
#4 [ROOT]\index.php(32): require_once('C:\\Web\\xampp\\ht...')
#5 {main}
System information
- Joomla! Version: 5.3.2
- PHP Version: (8.3)
- Web Server: (Apache, XAMPP)
- Database: (mariaDb)
- Template: Helix Ulitmate 2.1.3
Additional comments
The issue originates from how exceptions are handled in the application lifecycle.
A request for a non-existent page causes Joomla\CMS\Application\SiteApplication::route()
to throw a Joomla\CMS\Router\Exception\RouteNotFoundException
.
This exception is not caught within SiteApplication::doExecute()
, so it propagates up the call stack.
It is ultimately caught by the generic catch (\Throwable $throwable
) block within Joomla\CMS\Application\CMSApplication::execute()
.
This top-level exception handler treats all Throwable instances as critical errors, passing them to ExceptionHandler::handleException()
. It does not differentiate a standard 404 condition from a genuine 500-level server error.
The exception handler in CMSApplication::execute()
should maybe be modified to check if the caught exception is an instanceof RouteNotFoundException
and, if so, initiate the proper 404 response (set header, render template's error.php) instead of logging it as a critical failure.
Anyone familiar with that?
Update:
Can anyone verify if this error also occurs on other Joomla sites?
F.e. activate logging and visit your page root/notexistingurl and see if you get the error?
Codebase:
SiteApplication.php
RouteNotFoundException.php
CMSApplication.php
ExceptionHandler.php