Make WordPress Core

Opened 17 years ago

Closed 16 years ago

#7640 closed defect (bug) (fixed)

Upgrade has warnings when open_basedir is in effect

Reported by: oded's profile Oded Owned by:
Milestone: 2.7 Priority: lowest
Severity: minor Version: 2.7
Component: Upgrade/Install Keywords: needs-patch
Focuses: Cc:

Description

With open_basedir set in PHP to not include where the PHP error log is stored, the database upgrade process shows two PHP warnings (in red with full stack traces - not user friendly at all):

---8<-----
( ! ) Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/var/log/httpd/php-errors_log) is not within the allowed path(s): (/usr/lib/pear:/usr/share/pear/:/usr/share/php-adodb/:/usr/share/php-jaffa/:/var/www:/var/tmp/:/tmp:/vhosts/coil/geek/public_html) in /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php on line 500
Call Stack
# Time Function Location
1 0.0020 {main}() /vhosts/coil/geek/public_html/wp/wp-admin/upgrade.php:0
2 0.9184 wp_upgrade() /vhosts/coil/geek/public_html/wp/wp-admin/upgrade.php:68
3 0.9213 make_db_current_silent() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:149
4 0.9214 dbDelta() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:1109
5 1.0854 wpdb->query() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:1090
6 1.0957 wpdb->print_error() /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php:616
7 1.0963 is_writable () /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php:500

( ! ) Warning: is_writable() [function.is-writable]: open_basedir restriction in effect. File(/var/log/httpd/php-errors_log) is not within the allowed path(s): (/usr/lib/pear:/usr/share/pear/:/usr/share/php-adodb/:/usr/share/php-jaffa/:/var/www:/var/tmp/:/tmp:/vhosts/coil/geek/public_html) in /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php on line 500
Call Stack
# Time Function Location
1 0.0020 {main}() /vhosts/coil/geek/public_html/wp/wp-admin/upgrade.php:0
2 0.9184 wp_upgrade() /vhosts/coil/geek/public_html/wp/wp-admin/upgrade.php:68
3 0.9213 make_db_current_silent() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:149
4 0.9214 dbDelta() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:1109
5 1.0982 wpdb->query() /vhosts/coil/geek/public_html/wp/wp-admin/includes/upgrade.php:1090
6 1.0994 wpdb->print_error() /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php:616
7 1.0999 is_writable () /vhosts/coil/geek/public_html/wp/wp-includes/wp-db.php:500
---8<-----

The fix should be simple - in wp-includes/wp-db.php, line 500, use the "don't show warnings" syntax in the call to is_writable, changing that line to:

if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) )

Change History (23)

#1 @santosj
17 years ago

  • Milestone changed from 2.6.2 to 2.7
  • Priority changed from normal to low

#2 @santosj
17 years ago

  • Summary changed from Upgrade has warnnings when open_basedir is in effect to Upgrade has warnings when open_basedir is in effect

#3 @santosj
17 years ago

I think the cause should be corrected instead of covering up the symptom.

#4 @Otto42
17 years ago

is_writable is not particularly reliable, so using it would be a bad move, IMO.

Basically, the error stems from attempting to use the standard PHP error_log function when the host has implemented security such that the default error log is not allowed to be written to.

You could fix this by setting the error_log setting to a writable file (using ini_set). Alternatively, you could just turn off error logging by setting log_errors to false (also using ini_set).

#5 @ryan
17 years ago

ini_set would also need to be silenced because hosts disable it too.

#6 @santosj
17 years ago

I think it is disabled during safe_mode is on.

#7 @santosj
17 years ago

You know, I created a ticket and a patch that can be used to log errors.

#9 @ryan
17 years ago

(In [9199]) silence is_writable() warnings. see #7640

#10 @ryan
17 years ago

  • Milestone changed from 2.7 to 2.8

I papered over the problem for now. Moving this ticket to 2.8 for a more thoughtful fix.

#11 @mrmist
16 years ago

According to the forum you also hit this with Post edits so it could be a bigger issue. http://wordpress.org/support/topic/224372?replies=2#post-921404

#12 @mrmist
16 years ago

  • Version set to 2.7

#13 @jacobsantos
16 years ago

  • Keywords needs-patch added

#14 @DD32
16 years ago

According to the forum you also hit this with Post edits so it could be a bigger issue. http://wordpress.org/support/topic/224372?replies=2#post-921404

That appears to be realpath() breaking & returning false.. Bloody nuisance that function is.. I dont think its completely related to this ticket though.

#15 @ryan
16 years ago

  • Component changed from General to Upgrade/Install
  • Owner anonymous deleted

#16 @Denis-de-Bernardy
16 years ago

Could we just not make WP die with an angry error message (i.e. Get a real host!) when safe_mode and similar restrictions are on? After all, they're getting deprecated... :-)

#17 @DD32
16 years ago

Could we just not make WP die with an angry error message (i.e. Get a real host!) when safe_mode and similar restrictions are on? After all, they're getting deprecated... :-)

Unfortunately thats against WordPress's (and most developers) instincts of supporting users :)

#18 @Denis-de-Bernardy
16 years ago

  • Milestone changed from 2.8 to Future Release

sending this to the oubliette, then...

#19 @Denis-de-Bernardy
16 years ago

see also: #5953 (end of ticket related to realpath())

#20 @Denis-de-Bernardy
16 years ago

  • Milestone changed from Future Release to 2.9
  • Priority changed from low to lowest

#21 @hakre
16 years ago

  • Milestone changed from 2.9 to Unassigned
  • Resolution set to invalid
  • Status changed from new to closed

The reporter of this ticket is in error. First of all the messages he is reporting are beautified by xdebug. secondly it's the server configuration that is misleading here. error logging of php is logging into a file where open basedir does not allow it. so this is a configuration issue.

I will close the ticket as invalid now.

#22 @dd32
16 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#23 @dd32
16 years ago

  • Milestone changed from Unassigned to 2.7
  • Resolution set to fixed
  • Status changed from reopened to closed

Closing as fixed as the is_writable() warnings were silenced. Which as hakre has pointed out, Is about the most one can expect from this due to it being a bad PHP configuration.

Note: See TracTickets for help on using tickets.