Fork me on GitHub
Important security fix: 2.1.10, released 4 May.

patch to fix path issue in plugins/Minify @2.0.18.1

kiangkiang New
edited December 2011 in Feedback

--- a/plugins/Minify/min/lib/Minify/Controller/MinApp.php
+++ b/plugins/Minify/min/lib/Minify/Controller/MinApp.php
@@ -102,12 +102,13 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
             } else {
                 $base = '/';
             }
-            $allowDirs = array();
+            $vanillaPath = dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))));
+            $allowDirs = array($vanillaPath);
             foreach ((array)$cOptions['allowDirs'] as $allowDir) {
                 $allowDirs[] = realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
             }
             foreach ($files as $file) {
-                $path = $_SERVER['DOCUMENT_ROOT'] . $base . $file;
+                $path = $vanillaPath . DIRECTORY_SEPARATOR . $file;
                 $file = realpath2($path);
                 if (false === $file) {
                     $this->log("Path \"{$path}\" failed realpath()");

When setting up vanilla in the path other than DOCUMENT_ROOT, Minify will return "HTTP/1.0 400 Bad Request" when requesting minified css/js. This is just a quick hack to fix the problem.

Tagged:
Sign In or Register to comment.