Make WordPress Core

Opened 17 years ago

Closed 15 years ago

#5771 closed defect (bug) (fixed)

error_log in wp-db.php and install failures

Reported by: michaelh's profile MichaelH Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.3.2
Component: Warnings/Notices Keywords:
Focuses: Cc:

Description

Line 163 (at 2.3.3) in wp-includes/wp-db.php causes an installation failure on a number of hosts, where those hosts have turned off error logging.

Though this in not the fault of WordPress, the expedient solution is to comment out line 163 in wp-db.php.

Is there a better solution? Is there a test that can be added to the code so that in the event hosts have disabled error logging, the installation will procede?

Related info:
http://wordpress.org/support/topic/149537
http://wordpress.org/support/topic/149680
http://forums.crystaltech.com/index.php/topic,32891.0.html
http://community.plus.net/forum/index.php/topic,59525.0.html
http://www.php.net/manual/en/function.error-log.php

Attachments (1)

5771.diff (531 bytes) - added by tenpura 17 years ago.

Download all attachments as: .zip

Change History (21)

#1 @ryan
17 years ago

We can silence with "@".

#2 @ryan
17 years ago

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

(In [7037]) Silence warnings if error_log is disabled. fixes #5771

#3 @ryan
17 years ago

  • Milestone changed from 2.6 to 2.5

#4 @tenpura
17 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I got feedback from a user.
http://phpbb.xwd.jp/viewtopic.php?t=1762

The installation has succeeded with 2.3.3 with the error_log line commented out but still failed with an untouched version of latest trunk, so just using "@" to suppress warnings may not solve the problem itself.

#5 follow-up: @DD32
17 years ago

Silencing errors *should* prevent WP completely dieing, but given the feedback:

Just a thought though, Would using:

if ( ! function_exists('error_log') ){
function error_log($str,$str2){
}}

Make any difference? or does PHP not like that..

@tenpura
17 years ago

#6 in reply to: ↑ 5 @tenpura
17 years ago

Silencing errors *should* prevent WP completely dieing

Error control operator won't prevent scripts dieing if the error is fatal.
I am asking the same person to test the patch and will report if I hear the result from him.

#7 @DD32
17 years ago

Error control operator won't prevent scripts dieing if the error is fatal. I am asking the same person to test the patch and will report if I hear the result from him.

When error_log is disabled via disable_functions the error is simply a warning, Which can be silenced via the @ operator, At least in the PHP versions i've used.

Also, while function_exists will return false for disabled functions. I guess its either wrap it in that, or remove the call?

#8 @ryan
17 years ago

Just wrap in function_exists, I guess.

#9 @tenpura
17 years ago

I got the result from him. The installation has failed even with 5771.diff patch.
This means his system has error_log() and the problem occurs when error_log() is actually executed.
It could be a PHP platform/version dependent bug?

#10 @ryan
17 years ago

(In [7269]) Suppress logging of DB errors when checking if blog is installed. see #5771

#11 @ryan
17 years ago

That change should prevent the error message from the "is installed" check. That will at least get us past that point.

#12 @ryan
17 years ago

(In [7405]) Suppress errors during option retrieval while installing. see #5771

#13 @ryan
17 years ago

see also #5613 and #5720

#14 @ryan
17 years ago

I'm thinking that if the error_log ini setting specifies a file (rather than 'syslog'), check to see if that file is_writable. If not, don't try to error_log().

#15 @ryan
17 years ago

(In [7418]) Don't error_log() if error_log file is not writable. see #5771

#16 @ryan
17 years ago

(In [7419]) Don't error_log() if error_log file is not writable. see #5771

#17 @tenpura
17 years ago

I got the latest feedback from the tester. The installation was successful with the new fixes.

#18 @Otto42
17 years ago

This one never ends... User reports this error message on one server:

Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(error_log) is not within the allowed path(s)

http://wordpress.org/support/topic/186399

Add an @ in front of the is_writable call?

#19 @Denis-de-Bernardy
16 years ago

  • Component changed from General to Warnings/Notices

still current?

#20 @ryan
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Looks like is_writable is silenced. Closing.

Note: See TracTickets for help on using tickets.