WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 years ago

#5771 closed defect (bug) (fixed)

error_log in wp-db.php and install failures

Reported by: 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 6 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 ryan6 years ago

We can silence with "@".

comment:2 ryan6 years ago

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

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

comment:3 ryan6 years ago

  • Milestone changed from 2.6 to 2.5

comment:4 tenpura6 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.

comment:5 follow-up: DD326 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..

tenpura6 years ago

comment:6 in reply to: ↑ 5 tenpura6 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.

comment:7 DD326 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?

comment:8 ryan6 years ago

Just wrap in function_exists, I guess.

comment:9 tenpura6 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?

comment:10 ryan6 years ago

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

comment:11 ryan6 years ago

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

comment:12 ryan6 years ago

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

comment:13 ryan6 years ago

see also #5613 and #5720

comment:14 ryan6 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().

comment:15 ryan6 years ago

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

comment:16 ryan6 years ago

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

comment:17 tenpura6 years ago

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

comment:18 Otto426 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?

comment:19 Denis-de-Bernardy5 years ago

  • Component changed from General to Warnings/Notices

still current?

comment:20 ryan4 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.