Ticket #7640 (new defect)

Opened 3 months ago

Last modified 2 months ago

Upgrade has warnings when open_basedir is in effect

Reported by: Oded Assigned to: anonymous
Priority: low Milestone: 2.8
Component: General Version:
Severity: minor Keywords:
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

08/29/08 16:47:41 changed by santosj

  • priority changed from normal to low.
  • milestone changed from 2.6.2 to 2.7.

08/29/08 19:14:58 changed by santosj

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

08/29/08 19:16:03 changed by santosj

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

08/29/08 19:19:17 changed by Otto42

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).

08/29/08 20:00:07 changed by ryan

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

08/29/08 21:26:02 changed by santosj

I think it is disabled during safe_mode is on.

08/29/08 21:26:24 changed by santosj

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

08/29/08 21:27:41 changed by santosj

10/16/08 17:35:39 changed by ryan

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

10/16/08 17:36:17 changed by ryan

  • 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.