Replies: 3 comments 13 replies
-
Joomla 4 uses the Symfony ErrorHandler component as its global error code handler. This is registered in joomla-cms/libraries/bootstrap.php Line 55 in e7f5cc1 As far as 3PD code goes, the earliest point where we can execute code is normatively the onAfterInitialise event of system plugins which is called by There are some underhanded ways to load code earlier than that but it falls under “if you have to ask how to do it, you should not be doing it”.Going back to what you said: “I would like to execute a treatment”. I know what you are thinking. You can see what broke and figure out which plugin it is based on the namespace in the stack trace so you can disable it. Please don't. It is very easy to accidentally disable a plugin critical for the operation of the site. I am not talking just about the well-known plugins shipped with Joomla itself. Some third party templates require one or more system plugins. Disabling them breaks the site. There are many more non-obvious examples. Meanwhile, most of these problems tend to be transient. For example: temporary database connection issues while the DB server is restarting, temporary network timeouts when an interface is restarting / an upstream provider has issues, a stuck OPcache, etc. Yes, WordPress does disable plugins automatically… and it causes exactly those problems I described. There's a reason this feature and automatic updates are the first two things seasoned WordPress site administrators disable on their sites. FWIW, we had that idea as well for our own software — before WordPress started doing it. We realised the problems and decided to just implement a feature which sends emails about unhandled exceptions instead, describing it as an auxiliary site debug feature. |
Beta Was this translation helpful? Give feedback.
-
Ok I completely understand. Thank you @nikosdion for this detailed answer. So that's exactly the idea you were quoting that we were thinking of. So just to simplify the J3 to J4 migration, there might be some thought to be had in order to activate an "expert" mode to prevent a system plugin from crashing during the migration? |
Beta Was this translation helpful? Give feedback.
-
Also see #39484 |
Beta Was this translation helpful? Give feedback.
-
How to interact with the triggering of errors within the Joomla framework.
More exactly, where is the code that catches errors when a system plugin crashes?
I tried to find it around the execute() method of the CMSApplication (in joomla3) and the doExecute() of the SiteApplication (Joomla4), but I couldn't find it.
In the context of the crash of a plugin which causes a blocking of the site, I would like to execute a treatment.
Beta Was this translation helpful? Give feedback.
All reactions