Opened 6 years ago
Closed 5 years ago
#47321 closed enhancement (fixed)
Show different fatal error message when in Recovery Mode and unable to redirect
Reported by: | TimothyBlynJacobs | Owned by: | marybaum |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | 5.2 |
Component: | Site Health | Keywords: | has-patch servehappy has-copy-review copy-approved commit |
Focuses: | Cc: |
Description
WP_Fatal_Error_Handler::handle()
will call WP_Recovery_Mode::handle_error()
. If recovery mode is active, that method will try and refresh the page via a redirect to catch multiple errors at once. However, if headers have already been sent, it bails out and returns true.
This has the effect of printing the "The site is experiencing technical difficulties. Please check your site admin email inbox for instructions." when already in Recovery Mode which may be confusing. We should display a different message when the error was handled but we were unable to redirect.
Attachments (6)
Change History (48)
This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.
6 years ago
This ticket was mentioned in Slack in #core by sergey. View the logs.
6 years ago
#5
@
6 years ago
@TimothyBlynJacobs patch updated as ticket address in 5.2.2 milestone and change newly added document as per core standard.
Check below:
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/author-template.php#L182
https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-http.php#L156
@SergeyBiryukov Can you please check it and let me know if i am getting anything wrong.
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
6 years ago
#7
@
6 years ago
Adding a simple test case for triggering these errors and testing the patch would be very helpful.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
6 years ago
#10
follow-up:
↓ 12
@
6 years ago
Suggested copy:
“You’re in recovery mode, but for some reason we are unable to redirect you. This may mean there are several errors. Please contact your site admin, your developer or the WordPress support forums.”
#12
in reply to:
↑ 10
@
6 years ago
- Keywords needs-testing needs-unit-tests added; commit removed
Replying to marybaum:
Suggested copy:
“You’re in recovery mode, but for some reason we are unable to redirect you. This may mean there are several errors. Please contact your site admin, your developer or the WordPress support forums.”
I've refreshed the patch in 47321.3.diff to include @marybaum's suggested copy. Thanks @TimothyBlynJacobs & @mukesh27 for the initial patches.
Minor question: What's the policy on fancy quote in core? You’re
Also should the two other strings found in the display_default_error_template
function get some copy love as well to match the tone and conveyance of this string? They are;
} elseif ( is_protected_endpoint() ) {
$message = __( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' );
} else {
$message = __( 'The site is experiencing technical difficulties.' );
}
Also adding 'needs-unit-tests' to account for @afragen's request;
Adding a simple test case for triggering these errors and testing the patch would be very helpful.
#13
@
6 years ago
“You’re in recovery mode, but for some reason we are unable to redirect you. This may mean there are several errors. Please contact your site admin, your developer or the WordPress support forums.”
I'm not sure this is 100% correct. And I think we might end up displaying a severe message too often. In technical terms, this would happen when an error happens after the page has partially rendered to the screen. I think this could end up being a large number of errors. The only thing the user needs to do in this situation is manually refresh the page or navigate to another admin page.
#14
@
6 years ago
- Keywords needs-testing needs-unit-tests removed
“You’re in recovery mode, but for some reason we are unable to redirect you. Please try refreshing. If you see this again, please contact your site admin, your developer or the WordPress support forums.”
#16
follow-up:
↓ 17
@
6 years ago
- Keywords commit removed
Looks like this needs some more work.
we are unable to redirect you
This should be rewritten without the "we", see #46057.
Please contact your site admin, your developer
What if the user is a site admin or developer?
or the WordPress support forums
This should link to the forums.
if ( true === $handled ... )
Core does not generally use strict comparison in cases like this, if ( $handled ... )
should be enough.
#17
in reply to:
↑ 16
;
follow-up:
↓ 18
@
6 years ago
Replying to SergeyBiryukov:
if ( true === $handled ... )
Core does not generally use strict comparison in cases like this,
if ( $handled ... )
should be enough.
I don't think this will work in this case since a WP_Error
object will be truthy. $handled
is a bool|WP_Error
.
#18
in reply to:
↑ 17
@
6 years ago
Replying to TimothyBlynJacobs:
I don't think this will work in this case since a
WP_Error
object will be truthy.$handled
is abool|WP_Error
.
Ah, thanks, I missed that.
This ticket was mentioned in Slack in #core-php by spacedmonkey. View the logs.
6 years ago
#21
@
6 years ago
Copy here -- how about
There's been a fatal error, so you are now in recovery mode. Please check the Plugins and/or Themes page for details.
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
6 years ago
#24
@
6 years ago
- Milestone changed from 5.2.2 to 5.3
This ticket still needs some discussion. As seen per today's bug scrub, let's punt it to 5.3 so we could have a better resolution :-)
#26
follow-up:
↓ 27
@
5 years ago
- Keywords needs-copy-review removed
After discussing in #core-site-health here - https://wordpress.slack.com/archives/CKSU841L7/p1562699059112200
The decision was;
“There has been a critical error on your website, putting it in recovery mode. Please check the Themes and Plugins pages for more details. If you just now installed a new Theme or Plugin, check the relevant page for that first.”
#27
in reply to:
↑ 26
@
5 years ago
- Keywords needs-copy-review dev-feedback needs-unit-tests added; has-copy-review needs-refresh removed
Replying to garrett-eclipse:
After discussing in #core-site-health here - https://wordpress.slack.com/archives/CKSU841L7/p1562699059112200
The decision was;
“There has been a critical error on your website, putting it in recovery mode. Please check the Themes and Plugins pages for more details. If you just now installed a new Theme or Plugin, check the relevant page for that first.”
I've updated the verbiage according to the Slack discussion mentioned above in 47321.4.diff.
Aside from the verbiage the outstanding questions were;
Original comment by garrett-eclipse:
Also should the two other strings found in the
display_default_error_template
function get some copy love as well to match the tone and conveyance of this string? They are;
} elseif ( is_protected_endpoint() ) { $message = __( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' ); } else { $message = __( 'The site is experiencing technical difficulties.' ); }
Also adding 'needs-unit-tests' to account for @afragen's request;
Adding a simple test case for triggering these errors and testing the patch would be very helpful.
*Added dev-feedback
, needs-copy-review
and needs-unit-tests
to address these items.
#28
@
5 years ago
P.S. Please along with the initial patch props for @TimothyBlynJacobs & @mukesh27 can you please ensure additional props for the copy discussion be added for @SergeyBiryukov (as he provided input here on Trac), @marybaum, @clorith, @afragen and @mdwolinski as they participated in the Slack copy discussion. Thank you
#29
@
5 years ago
Please check the Themes and Plugins pages for more details.
I think admin pages are generally referred to as screens in documentation, to avoid confusion with page as a post type.
If you just now installed a new Theme or Plugin, check the relevant page for that first.
I don't think we generally capitalize "theme" or "plugin" in sentences like this.
Looks good to me otherwise.
#30
@
5 years ago
Thanks @SergeyBiryukov greatly appreciate the input
I've updated the patch (47321.5.diff) with the following;
- Updated versions to 5.3 from 5.2.2
- Updated 'pages' to 'screens'
- Lowercased references to installing themes and plugins but left the screen names capitalized.
- Updated the 'If you just now installed a theme or plugin' verbiage to cover updates by stating 'If you just installed or updated a theme or plugin'. *Also dropped 'now' as it felt redundant and in many cases they may have done an update before the weekend and only come back to work to find the issue later.
*Concerning the capitalization I went through core and from searching found that in a sentence a plugin or theme reference is lowercase such as install a plugin. But when referring to a screen it's a name and is capitalized.
Thoughts?
#31
follow-up:
↓ 32
@
5 years ago
*Probably easier to review at a glance if I surfaced the full sentence, in 47321.5.diff it is as follows;
'There has been a critical error on your website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.'
#32
in reply to:
↑ 31
@
5 years ago
I think we have a winner!
Replying to garrett-eclipse:
*Probably easier to review at a glance if I surfaced the full sentence, in 47321.5.diff it is as follows;
'There has been a critical error on your website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.'
#34
follow-up:
↓ 37
@
5 years ago
Awesome thanks @marybaum
So to move this forward the only outstanding questions were;
Also should the two other strings found in the display_default_error_template function get some copy love as well to match the tone and conveyance of this string? They are;
} elseif ( is_protected_endpoint() ) {
$message = ( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' );
} else {
$message = ( 'The site is experiencing technical difficulties.' );
}
Also adding 'needs-unit-tests' to account for @afragen's request;
Adding a simple test case for triggering these errors and testing the patch would be very helpful.
@clorith / @afragen / @TimothyBlynJacobs do we want to make those two additional strings consistent with this new one? And does this actually need Unit Tests?
Thanks
#35
@
5 years ago
I was only thinking of unit tests so we could be sure we know what activates this code. I’m OK with removing that tag.
#36
@
5 years ago
- Keywords needs-unit-tests removed
Thanks @afragen I've dropped the tag so the only remaining question is should those two additional strings be updated to be more consistent with the new verbiage. If not this is ready to move into commit, otherwise am happy to include those strings in the patch. Cheers
#37
in reply to:
↑ 34
@
5 years ago
Replying to garrett-eclipse:
OMG I missed this part completely! Yes, I think we should update these two strings to match.
<?php } elseif ( is_protected_endpoint() ) { $message= ( 'There has been a critical error. Please check your site's admin email for instuctions.' ); } else { $message= ( 'There has been a critical error.' ); }
Awesome thanks @marybaum
So to move this forward the only outstanding questions were;
Also should the two other strings found in the display_default_error_template function get some copy love as well to match the tone and conveyance of this string? They are;
} elseif ( is_protected_endpoint() ) {
$message = ( 'The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.' );
} else {
$message = ( 'The site is experiencing technical difficulties.' );
}
Also adding 'needs-unit-tests' to account for @afragen's request;
#38
@
5 years ago
Thanks @marybaum I've refreshed the patch - 47321.6.diff
@afragen / @SergeyBiryukov could you have a last look, I feel this is ready for commit
I've uploaded a patch that adds the different text. The text itself is really just a placeholder and needs to be discussed.