Ticket #5033 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

Better error_reporting and a debug mode

Reported by: ozh Assigned to: anonymous
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

const_wpdebug.diff (0.6 kB) - added by ozh on 09/21/07 19:03:07.
optional debug mode

Change History

09/21/07 19:03:07 changed by ozh

  • attachment const_wpdebug.diff added.

optional debug mode

09/21/07 19:06:05 changed by Nazgul

  • milestone changed from 2.3.1 to 2.4.

See #3155

09/21/07 19:35:31 changed by santosj

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;

09/21/07 21:15:15 changed by markjaquith

Santosj,

We can't modify wp-config.php -- so upgraders wouldn't get constant, and would be stuck in debug mode.

09/21/07 22:07:18 changed by santosj

if (defined('WPDEBUG') && ( true == WPDEBUG) ) {
   error_reporting(E_ALL);
} else {
   error_reporting(0);
}

Oh yeah. Assume Production, unless stated otherwise in config.php.

09/22/07 00:04:48 changed by g30rg3x

  • keywords changed from debug error_reporting e_all e_notice notice has-patch 2nd-opinion to has-patch 2nd-opinion.
  • 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

09/22/07 00:59:52 changed by foolswisdom

  • milestone changed from 2.3 to 2.4.

09/22/07 01:00:13 changed by foolswisdom

  • keywords changed from has-patch 2nd-opinion to has-patch 2nd-opinion early.

09/22/07 03:59:38 changed by darkdragon

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.

09/30/07 11:09:47 changed by westi

  • status changed from new to closed.
  • resolution set to fixed.

(In [6179]) Enable developers to turn on notices from wp-config.php. Relates #3155. Fixes #5033 props Ozh.

(follow-up: ↓ 11 ) 10/02/07 01:46:28 changed by matt

  • status changed from closed to reopened.
  • resolution deleted.

Could we make this have an underscore like almost all other of our defines. We should try to be consistent where possible.

(in reply to: ↑ 10 ) 10/02/07 08:10:12 changed by westi

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.

10/02/07 20:34:29 changed by westi

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [6181]) s/WPDEBUG/WP_DEBUG/g Fixes #5033

10/12/07 14:38:58 changed by docwhat

Shouldn't that be:

  error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);

So that user notices can be used?

Ciao!