Ticket #5033 (closed enhancement: fixed)
Better error_reporting and a debug mode
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 2.5 |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch 2nd-opinion early |
| Cc: |
Description
Following a discussion on wp-hackers in September, here is a proposition for a better error_reporting handling, and an optional debug mode (plugin) developers could activate on a per-blog basis
It would consist of the following:
in wp-settings.php:
if (defined('WPDEBUG') and WPDEBUG == true) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ E_NOTICE);
}
Then, on wp-config.php for developers:
define('WPDEBUG', true);
Attachments
Change History
-
attachment
const_wpdebug.diff
added
I think it should be:
if (defined('WPPRODUCTION') && ( true == WPPRODUCTION ) ) {
error_reporting(0);
} else {
error_reporting(E_ALL);
}
And have in the config.php
WPPRODUCTION = true;
comment:3
markjaquith — 4 years ago
Santosj,
We can't modify wp-config.php -- so upgraders wouldn't get constant, and would be stuck in debug mode.
if (defined('WPDEBUG') && ( true == WPDEBUG) ) {
error_reporting(E_ALL);
} else {
error_reporting(0);
}
Oh yeah. Assume Production, unless stated otherwise in config.php.
- Keywords debug error_reporting e_all e_notice notice removed
- Component changed from Optimization to General
- Milestone changed from 2.4 to 2.3
+1, but i think this should be consider in the 2.3 release
comment:8
darkdragon — 4 years ago
It is not my intention to be rude, the code would functionality be the same as it is now but allow those who want to see all errors to see them. However, I think that it should be instead assumed that if there is no WPDEBUG constant in wp-config.php, that the server is production.
In this way, I don't have to keep replacing the E_ALL with "0" each time I upgrade.
- Status changed from new to closed
- Resolution set to fixed
comment:10
follow-up:
↓ 11
matt — 4 years ago
- Status changed from closed to reopened
- Resolution fixed deleted
Could we make this have an underscore like almost all other of our defines. We should try to be consistent where possible.
comment:11
in reply to:
↑ 10
westi — 4 years ago
Replying to matt:
Could we make this have an underscore like almost all other of our defines. We should try to be consistent where possible.
I don't see why not.
It ended up as WPDEBUG as that was in the patch and I only looked at WPLANG when I was in my wp-config.php testing.
Searching the codebase WP_DEBUG makes more sense it seems.
comment:12
westi — 4 years ago
- Status changed from reopened to closed
- Resolution set to fixed
comment:13
docwhat — 4 years ago
Shouldn't that be:
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
So that user notices can be used?
Ciao!

optional debug mode