Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#21103 closed defect (bug) (fixed)

error_log() not called in wp-db.php when error_log setting is empty

Reported by: apimlott's profile apimlott Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4
Component: Database Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

The fix for #5771 is still not right. If the error_log setting in php.ini is empty (the default), errors should still be logged. (See http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log.) But in this case, ini_get('error_log') returns an empty string, so the iswritable check in wp-includes/wp-db.php line 935 (WordPress 3.4) fails and nothing is logged. Probably, there should be an test for empty string just as there is for 'syslog'.

Patch attached.

Attachments (1)

patch (560 bytes) - added by apimlott 13 years ago.
Patch against WordPress 3.4

Download all attachments as: .zip

Change History (6)

@apimlott
13 years ago

Patch against WordPress 3.4

#1 @apimlott
13 years ago

I was wrong about one thing. The is_writable check doesn't fail, it fails earlier because the empty return from ini_get is considered false. That's why I pulled the call to ini_get out of the condition.

#2 @wonderboymusic
12 years ago

  • Keywords has-patch added

#3 @nacin
12 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to 3.5

Can't we just always call error_log()? The conditional, function_exists, and error suppression all seem unnecessary.

#4 @wonderboymusic
12 years ago

yeah, the whole thing looks like overkill

#5 @nacin
12 years ago

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

In [21807]:

Call error_log() in wp-db without unnecessary conditionals. fixes #21103.

Note: See TracTickets for help on using tickets.