Page MenuHomePhabricator

GitInfo.php (used by Special:Version) should use DIRECTORY_SEPARATOR (PHP defined constant) instead of hardcoded "/"
Closed, ResolvedPublic

Description

I discovered that GitInfo.php still uses hardcoded directory path separators.

In my view it should better use system independent constant DIRECTORY_PATH instead of hardcoded "/".


Version: 1.21.x
Severity: normal

Details

Reference
bz46482

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:13 AM
bzimport set Reference to bz46482.
Wikinaut created this task.Mar 23 2013, 9:18 AM

You might want to make a general bug about that. Practically the entirety of core hardcodes /s.

For all the path stuff we do we have a grand total of 12 uses of DIRECTORY_PATH inside of core. And 9 of them are in GlobalSettings. The last three files only use it once.

Is DIRECTORY_PATH variable an already defined one ?
should changing GitInfo.php#L53
$this->basedir = $isAbsolute ? $path : "{$dir}/{$path}";
to
$this->basedir = $isAbsolute ? $path : "{$dir}".DIRECTORY_PATH."{$path}";
or sth similar do the trick ?

(In reply to comment #2)

Is DIRECTORY_PATH variable an already defined one ?

What I meant was: use the PHP-built-in constant DIRECTORY_SEPARATOR (string) see http://us3.php.net/manual/dir.constants.php

I have made a draft. Can you go through this and check whether its the right way to do it ?
https://gerrit.wikimedia.org/r/#/c/111777/

(In reply to comment #4)

I have made a draft.

Drafts are not public so basically nobody can access them.

Change 111777 had a related patch set (by 01tonythomas) published:
Used DIRECTORY_SEPARATOR instead of '/' in GitInfo.php

https://gerrit.wikimedia.org/r/111777

Change 111777 merged by jenkins-bot:
Used DIRECTORY_SEPARATOR instead of '/' in GitInfo.php

https://gerrit.wikimedia.org/r/111777