From 4cb2ba2cab1dcf3e6fb9e8a24a2b7198c1ab9ee0 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Sun, 13 Sep 2009 18:30:53 +0000 Subject: [PATCH] MinApp.php : Log problems involving 'allowDirs' option --- min/lib/Minify/Controller/MinApp.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/min/lib/Minify/Controller/MinApp.php b/min/lib/Minify/Controller/MinApp.php index 9582d29..44b32ce 100644 --- a/min/lib/Minify/Controller/MinApp.php +++ b/min/lib/Minify/Controller/MinApp.php @@ -104,16 +104,23 @@ class Minify_Controller_MinApp extends Minify_Controller_Base { } $allowDirs = array(); foreach ((array)$cOptions['allowDirs'] as $allowDir) { - $allowDirs[] = realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir)); + $allowDir = str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir); + $realAllowDir = realpath($allowDir); + if (false === $realAllowDir) { + $this->log("AllowDir path '{$allowDir}' failed realpath()"); + } else { + $allowDirs[] = $realAllowDir; + } } foreach ($files as $file) { $path = $_SERVER['DOCUMENT_ROOT'] . $base . $file; $file = realpath($path); if (false === $file) { - $this->log("Path \"{$path}\" failed realpath()"); + $this->log("Path '{$path}' failed realpath()"); return $options; } elseif (! parent::_fileIsSafe($file, $allowDirs)) { - $this->log("Path \"{$path}\" failed Minify_Controller_Base::_fileIsSafe()"); + $this->log("File '{$file}' was not found, or not located" + . " inside the 'allowDirs': " . var_export($allowDirs, 1)); return $options; } else { $sources[] = new Minify_Source(array(