[wp-trac] [WordPress Trac] #10609: WP writes htaccess file in account root when changing the URL in the admin area

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 14 17:41:50 UTC 2009


#10609: WP writes htaccess file in account root when changing the URL in the admin
area
----------------------------+-----------------------------------------------
 Reporter:  pyxis630        |       Owner:            
     Type:  defect (bug)    |      Status:  new       
 Priority:  high            |   Milestone:  Unassigned
Component:  Administration  |     Version:  2.8.4     
 Severity:  normal          |    Keywords:            
----------------------------+-----------------------------------------------

Comment(by pyxis630):

 I was doing some tests and the problem seems to be in the function
 get_home_path() in wp-admin/includes/file.php

 In line 73: $pos = strpos($_SERVER [ "SCRIPT_FILENAME" ],
 $wp_path_rel_to_home);

 the code tries to get the position of a string in a filename. On a Windows
 XAMPP system this looks like:

 $pos = strpos("C:/websites/SITE/wp-admin/options.php","http://SITE.com");

 $pos will be empty in that case. The resulting $home_path will be empty
 also, resulting in $home_path = '/'; ($home_path = trailingslashit(
 $home_path );)

 Now WordPress writes, if it has permission, the htaccess file in the root
 of the account. On this Windows setup this is C:\

 Can $_SERVER[ "SCRIPT_NAME" ] be used instead of $wp_path_rel_to_home?

 It would look like this:
 $pos = strpos("C:/websites/SITE/wp-admin/options.php","/wp-
 admin/options.php");
 and return a position for $home_path.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10609#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list