[wp-trac] [WordPress Trac] #13723: missuse of dirname(ABSPATH) in wp-load.php

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 4 11:01:46 UTC 2010


#13723: missuse of dirname(ABSPATH) in wp-load.php
--------------------------+-------------------------------------------------
 Reporter:  albanc        |       Owner:                      
     Type:  defect (bug)  |      Status:  new                 
 Priority:  normal        |   Milestone:  Unassigned          
Component:  General       |     Version:  2.9.2               
 Severity:  major         |    Keywords:  install open_basedir
--------------------------+-------------------------------------------------
 During wordpress installation, wp-config.php is not found on some systems
 raising an open_basedir error because the wp-config.php is looked in the
 upper directory of wordpress installation :


 {{{
 Warning: file_exists() [function.file-exists]: open_basedir restriction in
 effect. File(/var/www/vhosts/mind2machine.com/subdomains/agribio/wp-
 config.php) is not within the allowed path(s):
 (/var/www/vhosts/mind2machine.com/subdomains/agribio/httpdocs:/tmp) in
 /var/www/vhosts/mind2machine.com/subdomains/agribio/httpdocs/wp-load.php
 on line 36
 }}}


 In above error message, wordpress is located in path :

 {{{
 /var/www/vhosts/mind2machine.com/subdomains/agribio/httpdocs
 }}}

 But the wp-config file is looked in :

 {{{
 /var/www/vhosts/mind2machine.com/subdomains/agribio
 }}}


 This is due to the function dirname() being applied on ABSPATH at 3
 different locations in wp-load.php.
 However the dirname function is meant to retreive the folder name out of A
 FILE path. Appliying dirname on ABSPATH which is a FOLDER PATH returns the
 path with the last item truncated (here : httpdocs), thus a wrong path.
 Also, ABSPATH is already obtained from executing a dirname() function, so
 there is absolutely no need in any case to apply dirname() over it once
 again :

 {{{
 define( 'ABSPATH', dirname(__FILE__) . '/' );
 }}}


 '''BUG FIX :'''
 Replace any occurence of dirname(ABSPATH).'/wp-filename.php' by ABSPATH
 .'wp-filename.php'

 See patch attached.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13723>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list