WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#22203 closed defect (bug) (fixed)

WP_DEBUG - class wpdb prints errors while WP_DEBUG_DISPLAY is set to false

Reported by: storkontheroof Owned by: SergeyBiryukov
Milestone: 3.6 Priority: normal
Severity: normal Version: 2.9
Component: Database Keywords: has-patch commit
Focuses: Cc:

Description

The wpdb class prints errors when WP_DEBUG is true:

/wp-includes/wp-db.php line 539/540:

if ( WP_DEBUG )
    $this->show_errors();

To me seems this should be WP_DEBUG_DISPLAY.

My settings:

define('WP_DEBUG',         true);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG',     true);

So logging should be enabled, but display them on screen shouldn't.

Attachments (2)

22203.patch (462 bytes) - added by crazycoders 8 years ago.
Suggested fix
22203.2.patch (450 bytes) - added by SergeyBiryukov 8 years ago.
Fixed formatting and a typo

Download all attachments as: .zip

Change History (14)

#1 @SergeyBiryukov
9 years ago

  • Component changed from General to Database

#2 @storkontheroof
9 years ago

  • Severity changed from normal to critical

#3 @SergeyBiryukov
8 years ago

  • Version changed from trunk to 2.9

#4 @cheeserolls
8 years ago

Should be:

if ( WP_DEBUG && WP_DEBUG_DISPLAY )

$this->show_errors();

@crazycoders
8 years ago

Suggested fix

#5 @crazycoders
8 years ago

  • Cc crazycoders added
  • Keywords has-patch added

@SergeyBiryukov
8 years ago

Fixed formatting and a typo

#6 @SergeyBiryukov
8 years ago

  • Milestone changed from Awaiting Review to 3.6
  • Severity changed from critical to normal

#7 follow-up: @crazycoders
8 years ago

Why remove the {} in my patch, it's not good programming practice man? I agree with the && instead of & although both do exactly the same thing in this context...

#8 in reply to: ↑ 7 @SergeyBiryukov
8 years ago

Replying to crazycoders:

Why remove the {} in my patch, it's not good programming practice man?

See http://codex.wordpress.org/WordPress_Coding_Standards#Brace_Style.

#9 @DrewAPicture
8 years ago

22203.2.patch works as expected for me.

#10 @SergeyBiryukov
8 years ago

  • Keywords commit added

#11 @kovshenin
8 years ago

22203.2.patch works like a charm.

#12 @SergeyBiryukov
8 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 24027:

Only show database errors if WP_DEBUG_DISPLAY is enabled. props cheeserolls, storkontheroof, crazycoders. fixes #22203.

Note: See TracTickets for help on using tickets.