﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
17092,use dirname(__file__).'/file.php' instead of './file' for includes,ketwaroo,,"most initial includes prior to having ABSPATH defined are usually of the format:

{{{
#!php
require('./wp-blog-header.php');
}}}

as seen in the main index.php. Most of these occur in /wp-admin.

which is fine in most cases. Except on some windows servers where relative paths can get a bit funky. or if you're trying to include the file which contains a relative include in a file found in another directory (which happens when you're trying to use wordpress for something other than its intended purpose, like developing a more practical multisite system, on multiple domains, with a single copy of wordpress files for all the sites).

anyway, I just wanted to request that absolute paths be used for includes.

for example:

{{{
#!php
in /index.php
 require('./wp-blog-header.php');
becomes:
 require( dirname(__FILE__) . '/wp-blog-header.php' );
}}}
{{{
#!php
in /wp-admin/admin-ajax.php
 require_once('../wp-load.php');
becomes
 require_once( dirname(dirname(__FILE__)) . '/wp-load.php' );
}}}
{{{
#!php
in /wp-admin/maint/repair.php
 require_once('../../wp-load.php');
becomes
 require_once( dirname(dirname(dirname(__FILE__))) . '/wp-load.php' );
}}}

it may not look as pretty but I think it's a saner/safer method of inclusion. Just a suggestion for the next major release. Or as you gradually update files.

Attached is the patch I made from 3.1.1. It replaces every relative include|require(_once)? by absolute ones. As far as I've tested, works the same as unpatched and no includes are broken.",enhancement,new,normal,Awaiting Review,General,3.1.1,minor,,has-patch 2nd-opinion,ace_dent
