diff --git a/lib/Minify/Source/Factory.php b/lib/Minify/Source/Factory.php index cc3648a..2cec8d6 100644 --- a/lib/Minify/Source/Factory.php +++ b/lib/Minify/Source/Factory.php @@ -153,12 +153,17 @@ class Minify_Source_Factory { } if ($this->options['checkAllowDirs']) { + $inAllowedDir = false; foreach ((array)$this->options['allowDirs'] as $allowDir) { - if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) !== 0) { - throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs." - . " If the path is resolved via an alias/symlink, look into the \$min_symlinks option."); + if (strpos($this->getNormalizedPath($spec['filepath']), $this->getNormalizedPath($allowDir)) === 0) { + $inAllowedDir = true; } } + + if (!$inAllowedDir) { + throw new Minify_Source_FactoryException("File '{$spec['filepath']}' is outside \$allowDirs." + . " If the path is resolved via an alias/symlink, look into the \$min_symlinks option."); + } } $basename = basename($spec['filepath']);