Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#51230 new defect (bug)

WP_DEBUG is flagged when using the development environment type

Reported by: desrosj's profile desrosj Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.5
Component: Site Health Keywords:
Focuses: Cc:


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 (3)

#1 @desrosj
4 years ago

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 is development, and it may be OK to change the type from critical to recommended.

This is the current text:

Debug mode is often enabled to gather more details about an error or site failure, but may contain sensitive information which should not be available on a publicly available website.

Something like the following could be added to indicate the development environment type is being used.

Because the site is currently using the `development` environment type, this should be OK. If these are being manually defined in the `wp-config.php` file, remember to turn this off before moving the website live.

Version 0, edited 4 years ago by desrosj (next)

#2 @RobertReiser
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 @afragen
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.

Note: See TracTickets for help on using tickets.