meenie / munee

Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation

Home Page:https://munee.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Protected call errors - Fixed

vita10gy opened this issue · comments

Hey there, we just found this tool and so far so good. Only issue is we ran into a problem like #15 here, and after a bit of head scratching, solved the problem.

The issue is not related to protected calls, per se, it's because in PHP you can't have functions named the same name as the class. This was, and remains functional, the original way PHP did constructors. So it was actually calling the protected minify helper when trying to construct the Minify filter.

I can submit a pull request if this patch doesn't help, basically just rename the minify helper to literally anything else :). You can probably take the warnings about PHP versions and protected errors down with this.

diff -urN munee.orig/meenie/munee/src/Munee/Asset/Filter/Css/Minify.php munee/meenie/munee/src/Munee/Asset/Filter/Css/Minify.php
--- munee.orig/meenie/munee/src/Munee/Asset/Filter/Css/Minify.php   2015-03-12 13:13:01.383956616 -0500
+++ munee/meenie/munee/src/Munee/Asset/Filter/Css/Minify.php    2015-03-12 13:10:45.105126606 -0500
@@ -48,10 +48,10 @@

         $content = file_get_contents($file);
         if (Utils::isSerialized($content, $content)) {
-            $content['compiled'] = $this->minify($content['compiled']);
+            $content['compiled'] = $this->minifyh($content['compiled']);
             $content = serialize($content);
         } else {
-            $content = $this->minify($content);
+            $content = $this->minifyh($content);
         }

         file_put_contents($file, $content);
@@ -64,7 +64,7 @@
      *
      * @return string
      */
-    protected function minify($content)
+    protected function minifyh($content)
     {
         $regexs = array(
             // Remove Comments

Oh wow, so it doesn't take into consideration case? Because the function is lowercase and the class is uppercase. Interesting... It would be awesome if you submitted a PR. Also, please think of a better name than minifyh :)

All fixed!