Make WordPress Core

Opened 3 years ago

Closed 3 months ago

Last modified 3 months ago

#56252 closed enhancement (duplicate)

Allow error_reporting level to be configurable for WP_DEBUG

Reported by: luistar15's profile luistar15 Owned by: pbearne's profile pbearne
Milestone: Priority: normal
Severity: normal Version: 6.0
Component: Bootstrap/Load Keywords: has-patch 2nd-opinion
Focuses: performance Cc:

Description

I use WP_DEBUG_LOG in production to catch errors not caught during development.
But almost all entries are PHP Deprecated errors. This makes hard to spot more relevant errors.

It would be useful to be able to configure the error level report when using WP_DEBUG.

Attachments (1)

WP_DEBUG_ERROR_LEVEL.png (60.8 KB) - added by luistar15 3 years ago.
In the mean time I have modified the wp_debug_mode() function to acomplish what I need

Download all attachments as: .zip

Change History (10)

@luistar15
3 years ago

In the mean time I have modified the wp_debug_mode() function to acomplish what I need

#1 follow-up: @knutsp
3 years ago

Could this be combined into one constant? When WP_DEBUG is integer, use as error_level, otherwise truthy /falsey as currently. A few other constants work in a similar way.

#2 in reply to: ↑ 1 @luistar15
3 years ago

Replying to knutsp:

Could this be combined into one constant? When WP_DEBUG is integer, use as error_level, otherwise truthy /falsey as currently. A few other constants work in a similar way.

I wouldn't mind that. But personally a prefer multiple explicit settings rather that one that could mean many things.

This ticket was mentioned in PR #2994 on WordPress/wordpress-develop by luistar15.


3 years ago
#3

  • Keywords has-patch added

The new constant WP_DEBUG_ERROR_LEVEL can be set from wp-config.php to override the E_ALL level forced in wp_debug_mode() .

Trac ticket: https://core.trac.wordpress.org/ticket/56252

#4 @mikebricknellbarlow
2 years ago

Seconding this request - just been configuring my local dev environment so that I can leave WP_DEBUG turned on, but only see breaking errors. I ended up implementing the same solution as @luistar15, and actually came here to suggest it until I saw it was already here.

This would be a great help for agency developers like myself, who don't need to be seeing 100s of deprecated warnings from Core and plugins while trying to debug custom code.

#5 @pbearne
3 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to pbearne
  • Status changed from new to assigned

#6 @flixos90
3 months ago

  • Keywords 2nd-opinion added

@jorbin Since you were among the last people to touch wp_debug_mode() (only 9 years ago 😂), it would be great to get your feedback about this proposed enhancement.

The PR looks good to me for what it's supposed to achieve, but it would be good to get input on the idea from a long-term component maintainer like you.

#7 @jorbin
3 months ago

My first reaction: "I touched wp_debug_mode?"

My second thought: I think this is a duplicate of #31839. As there is a bit more discussion on that ticket, I think we should close this one and focus on that one. I'll throw a bit more there, but in general I can get behind making this configurable. It's going to require some documentation though since error_reporting will fatal if you pass in a non-integar. I don't think we need to go so far as to put in guard rails if you pass in a something besides an int, but I do think some documentation to help folks who cause a fatal is necessary.

#8 @pbearne
3 months ago

  • Milestone 6.8 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

#9 @pbearne
3 months ago

  • Resolution changed from invalid to duplicate

Duplicate of #31839.

Note: See TracTickets for help on using tickets.