1
0
mirror of https://github.com/mrclay/minify.git synced 2025-02-24 08:52:50 +01:00

Issue 24. Make sure all accesses of DOCUMENT_ROOT are first passed through realpath() to resolve symlinks.

This commit is contained in:
Steve Clay 2008-10-08 13:20:12 +00:00
parent 6dffb5e10e
commit 340c8a91fe
2 changed files with 5 additions and 7 deletions

View File

@ -282,7 +282,7 @@ class Minify_CSS {
$path = self::$_tempCurrentDir
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
// strip doc root
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT']));
$path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
// fix to absolute URL
$url = strtr($path, DIRECTORY_SEPARATOR, '/');
// remove /./ and /../ where possible
@ -294,11 +294,9 @@ class Minify_CSS {
}
}
}
if ($isImport) {
return "@import {$quote}{$url}{$quote}";
} else {
return "url({$quote}{$url}{$quote})";
}
return $isImport
? "@import {$quote}{$url}{$quote}"
: "url({$quote}{$url}{$quote})";
}
/**

View File

@ -141,7 +141,7 @@ class Minify_ImportProcessor {
$path = $this->_currentDir
. DIRECTORY_SEPARATOR . strtr($url, '/', DIRECTORY_SEPARATOR);
// strip doc root
$path = substr($path, strlen($_SERVER['DOCUMENT_ROOT']));
$path = substr($path, strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
// fix to absolute URL
$url = strtr($path, DIRECTORY_SEPARATOR, '/');
// remove /./ and /../ where possible