-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
WordPress - Display site-theme/decorations on error screens #22805
WordPress - Display site-theme/decorations on error screens #22805
Conversation
(Standard links)
|
5b99ebf
to
b7760d3
Compare
This looks much better than previous solutions 👍 @braders Quick question (I haven't time today to define('WP_DEBUG_DISPLAY', false); |
I'd need to review what Civi does in some more detail to be certain, but I think the display (or not) of the backtrace would be completely down to whether Civi is configured to display debug information - I'm fairly sure there is a system settings page where is is set. I don't think CiviCRM reads WP_DEBUG_DISPLAY by default, and I've not added any logic to read this constant. |
That does look like a nicer error screen! Here are some random thoughts. These are not all blockers - just general feedback/observations/suggestions.
|
a5d6d70
to
8be79db
Compare
jenkins retest this please. Known intermittent timestamp-rollover fail, which is touchy to fix because was part of a security release.
|
@seamuslee001 @christianwach @totten - is this mergeable now? |
@christianwach The debug display is controlled by CiviCRM's debug handling. I've done some |
I've added merge-ready based on @kcristiano ^^ - if we don't get further feedback we can merge |
Yeah, I think the updates from @braders look like a good improvement. 👍 I've written an end-to-end test to check the quality of error screens across different environments (#23257).
Something seems off:
But I think the status-code is maybe tangential:
I think it would be great to also resolve discrepancies in the error-status (and remove this opt-out), but that doesn't need to block improvements on the chrome/decoration. |
This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present. It appears that the markup from WordPress has changed slightly. (It may be that I originally tested against an older version of WP.) In any event, this relaxes the test so that it also passes on a newer WP build.
This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present on certain error-messages; however, the underlying behavior was only implemented on WordPress. It has not yet been implemented on other CMS. Before ------ * __WordPress__: Runs testErrorChrome. Expected to pass. * __Drupal 7__: Skip testErrorChrome (mostly) because it is expected to fail. * __Drupal 8+, Backdrop__: Runs testErrorChrome. Fails. After ----- * __WordPress__: Runs testErrorChrome. Expected to pass. * ___Drupal 7, Drupal 8+, Backdrop__: Skip testErrorChrome (mostly) because it is expected to fail.
This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present on certain error-messages; however, the underlying behavior was only implemented on WordPress. It has not yet been implemented on other CMS. Before ------ * __WordPress__: Runs testErrorChrome. Expected to pass. * __Drupal 7__: Skip testErrorChrome (mostly) because it is expected to fail. * __Drupal 8+, Backdrop__: Runs testErrorChrome. Fails. After ----- * __WordPress__: Runs testErrorChrome. Expected to pass. * ___Drupal 7, Drupal 8+, Backdrop__: Skip testErrorChrome (mostly) because it is expected to fail. Comment ------- It still runs `testErrorChrome` for `permission` errors; per MM discussion, it appears that this does actually work, but we need to tune assertion for BD+D8.
This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present on certain error-messages; however, the underlying behavior was only implemented on WordPress. It has not yet been implemented on other CMS. Before ------ * __WordPress__: Runs testErrorChrome. Expected to pass. * __Drupal 7__: Skip testErrorChrome (mostly) because it is expected to fail. * __Drupal 8+, Backdrop__: Runs testErrorChrome. Fails. After ----- * __WordPress__: Runs testErrorChrome. Expected to pass. * ___Drupal 7, Drupal 8+, Backdrop__: Skip testErrorChrome (mostly) because it is expected to fail. Comment ------- It still runs `testErrorChrome` for `permission` errors; per MM discussion, it appears that this does actually work, but we need to tune assertion for BD+D8.
….1+) Import - also export invalid as export error I found that rows that fail validation are marked 'invalid' rather than error & won't show on the preview screen. I guess I could check for invalid vs error separately - gets kinda weird though - if you leave them in the file you are importing surely they are still errors to see on the summary screen even though you knew they were invalid on the Preview? (E2E) testErrorChrome - Skip Backdrop and D8+ (much like D7) This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present on certain error-messages; however, the underlying behavior was only implemented on WordPress. It has not yet been implemented on other CMS. Before ------ * __WordPress__: Runs testErrorChrome. Expected to pass. * __Drupal 7__: Skip testErrorChrome (mostly) because it is expected to fail. * __Drupal 8+, Backdrop__: Runs testErrorChrome. Fails. After ----- * __WordPress__: Runs testErrorChrome. Expected to pass. * ___Drupal 7, Drupal 8+, Backdrop__: Skip testErrorChrome (mostly) because it is expected to fail. Comment ------- It still runs `testErrorChrome` for `permission` errors; per MM discussion, it appears that this does actually work, but we need to tune assertion for BD+D8. (E2E) `testErrorChrome` - Update to work with current wp-demo build This test was added during 5.50.alpha (civicrm#23257, civicrm#22805). It's purpose is to assert that the page-chrome/site-wide-template is present. It appears that the markup from WordPress has changed slightly. (It may be that I originally tested against an older version of WP.) In any event, this relaxes the test so that it also passes on a newer WP build. (E2E) testErrorChrome - Revise page-chrome check for all Drupal-style UFs
Overview
This builds on the previous work completed by @seamuslee001 in #20206, but addresses some concerns with the original approach.
This new approach keeps the use of
CRM_Core_Exception
, ensuring that existing logging and hooks are not lost. As WordPress does not have a generictheme()
function to theme a generic error message we need to ensure that the execution does notexit
to allow the error message to be dropped into the page content - demonstated with a couple of default themes:Before
Previously a completely unbranded, and minimally styled error page was used:
After
The error message is embedded in the post content, as demonstrated in the screnshots above.
Technical Details
There may be some (legitimate) concerns about not calling
exit
after an error, which is fair - consideration should be given to whether I'm missing anything when reviewing this.I did wonder if the
$civicrm_wp_title
variable should be set within theCRM_Core_Error
method to avoid leaking information when exceptions happen which don't pass through thepermissionDenied
method. Ultimately I decided this probably wasn't a big risk, but it would be good to check no one else disagrees here.This can be tested in two ways:
throw new CRM_Core_Exception('This is a test exception')
to the relevant form. (unless you know of a specific route which causes a legitimate exception).permissionDenied
method.