Adds new WP_DEBUG_LEVEL constant to load.php #5494
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
My proposal is to add a new constant used in wp-includes/load.php changing the setting of error_reporting.
This would introduce the constant WP_DEBUG_LEVEL which developers can use to set their own level of error reporting in wp-config.php while defaulting back to the same value it has always been in WordPress.
It would not cause issues with any existing WordPress install.
It would allow developers that want to upgrade to PHP 8 while still being able to use WP_DEBUG in their development environment.
It would overall support the use of a single constant for a WordPress install to use for determining the desired error reporting level. This means that plugin developers can also use this constant to set their desired log level in their code. An example of a valid case of such can be found in the WP Sentry plugin where there's a constant called WP_SENTRY_ERROR_TYPES used. This could default to using WP_DEBUG_LEVEL if that is set.
Trac ticket: https://core.trac.wordpress.org/ticket/31839
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See Pull Requests for Code Review in the Core Handbook for more details.