(via SebSauvage et Bronco)
Il peut y avoir un warning levé avec realpath à cause d'open_basedir (ligne 450 de DirectoryLister.php).
Pour y remédier, j'ai proposé cette fonction.
En attendant que la modif soit prise en compte, je vous la livre ici :
{code
/**
- When using realpath (and similar functions), PHP will take in to account open_basedir restrictions.
- Because realpath() does not work on files that do not
- exist, this function replaces (consecutive) occurences of / and \ with
- whatever is in DIRECTORY_SEPARATOR, and processes /. and /.. fine.
-
- @param $path string
- @return absolute path Paths returned by get_absolute_path() contain no
- (back)slash at position 0 (beginning of the string) or
- position -1 (ending)
-
- @author Sven Arduwie (https://php.net/manual/fr/function.realpath.php#84012)
*/
protected function _get_absolute_path($path) {
$realPath = @realpath($path);
if (! $realPath) {
$path = str_replace(array('/', '\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part) continue;
if ('..' == $part) {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
$realPath = implode(DIRECTORY_SEPARATOR, $absolutes);
}
return $realPath;
}
code}
Ceci dit, c'est vrai que h5ai est bien aussi mais moins minimaliste.