This is in db_set_active() (http://api.drupal.org/api/function/db_set_active/6) in database.inc in D7 and D6, and db_connect() in database.mysql.inc in D5.

This issue would be superceded in D7 by #259623: Broken autoloader: convert includes/requires to use absolute paths if that lands, but the bug remains in D6 and D5 (see e.g. http://drupal.org/node/259375).

CommentFileSizeAuthor
#5 296194_pathauto_anchor_includes.patch978 bytesgreggles

Comments

damien tournoud’s picture

Title: install.inc is included as 'includes/install.inc' instead of './includes/install.inc' » Some includes are not anchored

Widening the issue:

# egrep -r "include_once '[^.]" *
5.x/includes/database.mysql.inc:      include_once 'includes/install.inc';
5.x/includes/database.mysql.inc:      include_once 'includes/install.inc';
6.x/install.php:    include_once 'includes/batch.inc';
6.x/install.php:      include_once 'includes/locale.inc';
6.x/install.php:    include_once 'includes/batch.inc';
6.x/install.php:    include_once 'includes/locale.inc';
6.x/install.php:      include_once 'includes/locale.inc';
6.x/install.php:    include_once 'includes/batch.inc';
6.x/install.php:    include_once 'includes/locale.inc';
6.x/includes/database.inc:    include_once 'includes/install.inc';
6.x/modules/locale/locale.module:  include_once 'includes/locale.inc';
7.x-dev/install.php:    include_once 'includes/batch.inc';
7.x-dev/install.php:      include_once 'includes/locale.inc';
7.x-dev/install.php:    include_once 'includes/batch.inc';
7.x-dev/install.php:    include_once 'includes/locale.inc';
7.x-dev/install.php:      include_once 'includes/locale.inc';
7.x-dev/install.php:    include_once 'includes/batch.inc';
7.x-dev/install.php:    include_once 'includes/locale.inc';
7.x-dev/includes/database.inc:    include_once 'includes/install.inc';
7.x-dev/modules/locale/locale.module:  include_once 'includes/locale.inc';
gpk’s picture

Hmm I wonder, when an expression is used to determine the file to include_once or require_once ... whether it always properly anchored...

gpk’s picture

Version: 7.x-dev » 5.10

In 5.x, as well as the unanchored include_once 'includes/install.inc'; on lines 62 and 99 of database.mysql.inc, there also looks to be a problem on line 74 of color.module which has include $file; but $file will begin with "themes" or "sites" rather than "." or "/". Changing it to include "./$file"; should fix that. Should the "include" also be changed to "include_once"? (There's another straight "include" on phptemplate.engine line 412).

Also there are a couple of places that use include_once(<file>) syntax, but as that's not a bug it don't need fixing I guess.

A bit of grepping revealed a few further places where the filename referenced by include_once or require_once is a variable. However it looks as though the variable begins with './' in these cases. For reference they are:
install.php:416
module.inc:229
image.inc:36
database.inc:118
install.inc:271
install.inc:687
install.inc:699
install.inc:727

gpk’s picture

Looks like there may also be many more places with this problem in 6.x, e.g. 2 require_once's in menu.inc http://api.drupal.org/api/file/includes/menu.inc/6/source (highlighted by http://drupal.org/node/332124).

greggles’s picture

Priority: Minor » Normal
Status: Active » Needs review
StatusFileSize
new978 bytes

@gpk - how does this look?

@everyone else? test? please?

greggles’s picture

Status: Needs review » Active

oooops

I'm an idiot and was trying to attach this to #331357: Requires are unanchored.

dpearcefl’s picture

Status: Active » Closed (won't fix)

Considering the time elapsed between now and the last comment plus the fact that D5 is no longer supported, I am closing this ticket.