gaurav-spacreo / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Minify_JS_ClosureCompiler usage of http_build_query might result error with & #189

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Minify version: SVN r421
PHP version: 5.3.2

By default http_build_query [1] uses the arg_separator.output [2] for 
separating the parametres given to it.
In order to be xhtml strict compliant thus setting is often turned from its 
default value '&' to '&' for example via .htaccess directive [3].

When making the request to the Closure Compiler, it does not accept the latter 
form of the separator.

In order to fix this, I suggest adding this value as a parametre to the 
http_build_query function, like the diff below shows.

[1] http://php.net/http_build_query
[2] http://www.php.net/manual/en/ini.core.php#ini.arg-separator.output
[3] php_value arg_separator.output "&"

Index: ClosureCompiler.php
===================================================================
--- ClosureCompiler.php (revision 421)
+++ ClosureCompiler.php (working copy)
@@ -96,7 +96,7 @@
             'output_info' => ($returnErrors ? 'errors' : 'compiled_code'),
             'output_format' => 'text',
             'compilation_level' => 'SIMPLE_OPTIMIZATIONS'
-        ));
+        ), '', '&');
     }

     protected function _fallback($js)

Original issue reported on code.google.com by olavic on 4 Aug 2010 at 7:42

GoogleCodeExporter commented 9 years ago
Nice catch. I'll apply your patch soon. Otherwise is it working OK? I got some 
denials from too many requests while I was testing...

Original comment by mrclay....@gmail.com on 4 Aug 2010 at 7:48

GoogleCodeExporter commented 9 years ago
Against an array of twelve files it seemed to run pretty well.

My application saves the resulting file and checks upon page request if the 
source for that minified file has been updated. If that is the case, then it 
will make a request just for that file.
This will keep the requests low after the initial patch, this case 12.

Great library, makes life much easier.

Original comment by olavic on 4 Aug 2010 at 8:10

GoogleCodeExporter commented 9 years ago
Fixed in R422

Original comment by mrclay....@gmail.com on 6 Aug 2010 at 3:11