Opened 4 years ago
Last modified 7 weeks ago
#51230 new defect (bug)
WP_DEBUG is flagged when using the development environment type
Reported by: | desrosj | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Site Health | Keywords: | good-first-bug has-patch |
Focuses: | Cc: |
Description
This was a request from the comments of the New `wp_get_environment_type() function in WordPress 5.5 post from @robertreiser:
Setting the environment to development also sets WP_DEBUG, which makes sense and I had WP_DEBUG enabled anyway on my development site.
But the site health tool still shows an error regarding the use of WP_DEBUG:
Your site is set to display errors to site visitors
In case if setting the environment to development, this should no longer be shown as an error in the site health tool.
Change History (9)
#2
@
4 years ago
Thank you for the consideration of my comment on the WP Core blog and for turning it into a ticket, I really appreciate that. I just wanted to share some additional thoughts:
A WP user who modifies wp-config.php
by either setting the WP_DEBUG
flag or by setting the environment usually knows what they are doing and they do it on purpose. This is probably not the average WP user.
So I would argue that even if it is not exactly known how WP_DEBUG
was set, it should not trigger either a warning or a recommendation in the site health tool when the environment is a development environment.
#3
@
4 years ago
The site health error is about displaying errors to site visitors. The WP_DEBUG_DISPLAY
constant is set to true as a default. Setting it to false removes this error.
I do realize that in a development environment we should be encouraging the visibility of these errors for testing. We should be able to understand what this error means and its context.
All that being said, giving the message some context with wp_set_environment_type()
is probably a good thing.
#4
follow-up:
↓ 6
@
2 months ago
- Keywords good-first-bug needs-patch added
Adding good-first-bug
to explore a few ways to add some additional context for development
sites.
This ticket was mentioned in Slack in #core by desrosj. View the logs.
2 months ago
#6
in reply to:
↑ 4
;
follow-up:
↓ 8
@
8 weeks ago
Replying to desrosj:
Adding
good-first-bug
to explore a few ways to add some additional context fordevelopment
sites.
I believe this issue has been resolved. After examining the source code in class-wp-site-health.php, I noticed a condition that sets the status to 'recommended' rather than 'critical' in development environments:
// On development environments, set the status to recommended. if ( $this->is_development_environment() ) { $result['status'] = 'recommended'; }
This ticket was mentioned in PR #7178 on WordPress/wordpress-develop by @xaymup.
8 weeks ago
#7
- Keywords has-patch added; needs-patch removed
Fixing https://core.trac.wordpress.org/ticket/51230
Trac ticket:
Because there is no way to know how the constant is defined (manually in the
wp-config.php
file vs. set by WP Core after checking the environment type), I am of the opinion that this should still be flagged. However, I think the wording could be changed when the environment type isdevelopment
, and it may be OK to change the type from critical to recommended.This is the current text:
Something like the following could be added to indicate the
development
environment type is being used.