WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 4 months ago

#46877 closed defect (bug) (fixed)

Site Health warns about `WP_DEBUG_DISPLAY` when `WP_DEBUG` is the cause.

Reported by: mikeschroder Owned by: mikeschroder
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: site-health has-patch
Focuses: administration Cc:
PR Number:

Description

I was testing site health and noticed the messaging for the WP_DEBUG check doesn't match what is in my test site.

The warning says "The value, WP_DEBUG_DISPLAY, has either been added to your configuration file, or left with its default value.“, which doesn’t make it clear that it’s WP_DEBUG that did it.

https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/default-constants.php#L82
https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/load.php#L276

I think it'd be great to adjust the wording of the message so that it's clear to users that WP_DEBUG in wp-config.php causes/can cause this behavior, so that they aren't confused by WP_DEBUG_DISPLAY not being in their wp-config.php.

I'll have a go at wording, but if someone else gets to it first, then great!

Attachments (3)

46877.diff (902 bytes) - added by mikeschroder 6 months ago.
46877.2.diff (992 bytes) - added by mikeschroder 6 months ago.
Hopefully corrected addition of second string and context notes with suggestion for second from @clorith.
46877.3.diff (1.4 KB) - added by mikeschroder 6 months ago.

Download all attachments as: .zip

Change History (15)

@mikeschroder
6 months ago

#1 @mikeschroder
6 months ago

Uploaded an initial idea for this in 46877.diff. I'll note, talking about constants as "the value" sounds a bit odd to me, and I think something that says that [constant name] is enabled/added/set to true in wp-config.php would be clearer, but I'm guessing I'm missing some background here.

In that light, an alternate suggestion as well:

The constant WP_DEBUG_DISPLAY was enabled by WP_DEBUG or added to wp-config.php. This will make errors display on the front end of your site.

#2 follow-up: @mukesh27
6 months ago

  • Keywords has-patch added; needs-patch removed

@mikeschroder Can you please add /* translators: %s: Name of the constant used. */ for both constant

#3 in reply to: ↑ 2 @mikeschroder
6 months ago

Replying to mukesh27:

@mikeschroder Can you please add /* translators: %s: Name of the constant used. */ for both constant

Thank you!
The patch adds a second identical line to account for the new %s that I added. Did I do so incorrectly? If so, where should the second one go -- or should it have a different context?

#4 @mukesh27
6 months ago

@mikeschroder my mistake no need to change translators as both constant are default.

@mikeschroder
6 months ago

Hopefully corrected addition of second string and context notes with suggestion for second from @clorith.

#5 @mikeschroder
6 months ago

  • Milestone changed from Awaiting Review to 5.2

I've got a lot to learn with internationalization.
Hopefully 46877.2.diff is in the right direction.

Used suggestion from @clorith for second string's context.
Adding to milestone for consideration after chatting with them about it.

#6 @ocean90
6 months ago

You can actually name the constant in the comment: 1: WP_DEBUG_DISPLAY, 2: WP_DEBUG. The same should be done for the message about WP_DEBUG_LOG: %s: WP_DEBUG_LOG.

#7 @mikeschroder
6 months ago

In 46877.3.diff, made the changes @ocean90 recommended.

#8 @SergeyBiryukov
6 months ago

  • Component changed from General to Administration
  • Keywords commit added

#9 @mikeschroder
6 months ago

  • Owner set to mikeschroder
  • Status changed from new to assigned

Thanks @SergeyBiryukov, I'll get this committed.

#10 @mikeschroder
6 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 45164:

Site Health: Clarify WP_DEBUG warning and translation contexts.

Clarifies that WP_DEBUG can cause WP_DEBUG_DISPLAY to be enabled,
and uses the constants themselves in related translation contexts.

Props mukesh27, ocean90, clorith, SergeyBiryukov, mikeschroder.
Fixes #46877.

#11 @mikeschroder
6 months ago

  • Keywords commit removed

#12 @spacedmonkey
4 months ago

  • Component changed from Administration to Site Health
Note: See TracTickets for help on using tickets.