-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(dev/joomla#10) Remove Joomla-specific error display and use native CiviCRM #15159
Conversation
(Standard links)
|
test this please |
@vingle are you able to help with review on all this great Joomla! work @andrewpthompson is doing? |
@eileenmcnaughton - I’m on holiday this week but will test when I’m back after Monday (any tips on a simple way to trigger an error message?) |
I think you get an error if you try to view a contact with an invalid id |
@vingle To trigger errors I was using a contribution page with no payment processor defined and also trying to run the database upgrader when the db has already been upgraded. administrator/index.php?option=com_civicrm&task=civicrm/upgrade&reset=1 |
That works for me. One thing perhaps worth noting is that handling of those errors front and backend is currently different. Ie With this patch, both front and backend use CiviCRM's error styling, so anyone currently using custom styled, front-end error pages that match their public-facing theme would, I guess, lose that with this commit. That's probably a pretty rare use-case, but figured it's worth mentioning. |
@andrewpthompson Do you have any thoughts on that last comment? |
} | ||
else { | ||
echo CRM_Utils_System::theme($content); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vingle wrote:
anyone currently using custom styled, front-end error pages that match their public-facing theme would, I guess, lose that with this commit.
civicrm-core
has a setting fatalErrorHandler
which you can use to define a custom function for emitting an error. I wonder if it work as an off-ramp to:
- Put this old code-block in a separate function (e.g.
CRM_Utils_System_Joomla::mapToJError
orCRM_Core_Error::useJoomlaError
) - In the post-upgrade message on Joomla sites, advise that the error-handling has been normalized to consistently display error messages - but that you can continue using
JError
by setting the optionfatalErrorHandler
toCRM_Utils_System_Joomla::mapToJError
(or whatever it's called)
(Of course, that would be have to be tested, and I don't know off the top of my head the best place to put that function..)
OTOH, if no one is likely to use the option, then just KISS and carry on without...
@vingle In every Joomla-provided template that I checked in J3 and J4 the error messages go through I'm personally not too concerned about simply using CiviCRM's styling as these fatal errors or unhandled exceptions are the nasty things that shouldn't normally happen. I like @totten's suggestion though and could have a look at this is Joomla folk think it would be of use. |
@andrewpthompson I agree – I don't think this needs to be mitigated as Civi errors shouldn't be visible to end-users unless the site is broken. I just thought I should mention/log in case someone wondered why their error messages had changed. |
OK - since you are in agreement I will merge - perhaps @agh1 can highlight in the release notes |
Overview
See https://lab.civicrm.org/dev/joomla/issues/10
CiviCRM fatal errors & unhandled exceptions are rendered very poorly on Joomla due to the inability of Joomla's exception handling to handle HTML in error messages. CiviCRM uses HTML in the error messages, plus inline script and CSS from the template and this is all displayed on the Joomla error page.
Because of these Joomla constraints (we can only use plain text and not even new line characters) it is better to remove the Joomla-specific way of rendering errors and display natively in CiviCRM as for Drupal.
Before
Fatal errors & unhandled exceptions are very dificult to read on Joomla:
After
Fatal errors & unhandled exceptions are rendered natively by CiviCRM:
Technical Details
This PR consists of:
CRM_Core_Error::handleUnhandledExecption()
if config->userFramework != 'Joomla'
fromtemplates/CRM/common/fatal.tpl
so that a full html page is outputCRM_Utils_System_Joomla::outputError()
altogether so that the parentCRM_Utils_System::outputError()
is used instead.Comments
Joomla's JError is deprecated so this also helps remove instances of its usage.