Make WordPress Core

Opened 7 years ago

Last modified 3 months ago

#13657 assigned enhancement

When WP_DEBUG is true show better errors for establishing database connection

Reported by: sivel Owned by:
Milestone: Future Release Priority: low
Severity: trivial Version:
Component: Database Keywords: has-patch dev-feedback
Focuses: Cc:


Right now no matter if WP_DEBUG is enabled or not we always show some generic errors for Error establishing a database connection

We should display the specific error when WP_DEBUG is enabled.

Attachments (2)

13657.diff (2.6 KB) - added by sivel 7 years ago.
13657.2.diff (695 bytes) - added by Mte90 3 months ago.

Download all attachments as: .zip

Change History (12)

#1 @sivel
7 years ago

Patch is just an idea of how we might do this. Open to other suggestions and patches.

7 years ago

#2 @nacin
7 years ago

I would tend to think we should not be exposing the output of mysql_error() on any site. Or, if we do, then we at least also check for display_errors/WP_DEBUG_DISPLAY, in case they want WP_DEBUG (as can be common in production) but are logging it.

#3 @nacin
7 years ago

  • Keywords early removed

#4 @nacin
7 years ago

  • Milestone changed from Awaiting Triage to Future Release

#5 @sivel
6 years ago

The way that translations are handled for these errors makes it difficult to do conditionals like this. Mainly due to duplicating large portions of code and strings. Well maybe not large but more than I am comfortable with duplicating.

I may just need to stare at the code for a bit to get a creative solution, that is unless someone has recommendations.

#6 @mbijon
4 years ago

  • Cc mike@… added

#7 @ryan
3 years ago

  • Owner ryan deleted
  • Status changed from new to assigned

#8 @chriscct7
18 months ago

  • Keywords dev-feedback added

#9 @pento
18 months ago

  • Keywords needs-refresh added; dev-feedback removed

The strings have since been split up, making it much easier to insert a conditional string when WP_DEBUG and WP_DEBUG_DISPLAY are defined.

3 months ago


#10 @Mte90
3 months ago

  • Keywords dev-feedback added; needs-refresh removed

I updated the patch but I am not sure about mysql_error because maybe wpdb have a wrapper for that but I am not an expert for this part.

Note: See TracTickets for help on using tickets.