Bug #53627 [NEW]: ob_gzhandler don't gzip some JS file

From: Date: Wed, 29 Dec 2010 10:59:30 +0000
Subject: Bug #53627 [NEW]: ob_gzhandler don't gzip some JS file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157377@lists.php.net to get a copy of this message
From: Operating system: windows PHP version: 5.3.4 Package: Output Control Bug Type: Bug Bug description:ob_gzhandler don't gzip some JS file Description: ------------ hello when I try to create compression function on CSS and JS file I found a strange issue all my css file and JS file is correctly Gziped but not JQuery.js (minimized or not) I try with a regulard PHP code (ob_start('ob_gzhandler') ) or directly in the php.ini (zlib.output_compression = On) the result is the same the Jquery JS will not be compressed If I delete some line in the file compression is done (but the file is incomplet) If I add other file (to the JQuery JS) who are correctly compressed the all file are not compressed If I configure in Apache the mod_deflate all file are Gziped The JQuery file are here http://jquery.com/ I look if the compression is done with chrome (developement tools) Here when the compression is done with PHP http://img709.imageshack.us/f/screenshot220t.jpg/ Here where the compression is done with Apache http://img52.imageshack.us/f/screenshot221q.jpg/ In the HTTP header response the GZIP is correctly set the file I use is here http://www.megaupload.com/?d=AVY3LFQO best regards Test script: --------------- <?php // to activate to compress with PHP /* if(extension_loaded('zlib')){ ob_start('ob_gzhandler'); }*/ header("Content-type: application/javascript"); header ('cache-control: must-revalidate'); $offset = 60 * 60 * 24; $expire = 'expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT'; header ($expire); // test with include // liste JS files to be included //include 'jquery-1.4.4.min.js'; //include 'sha256.min.js'; // test with join file echo join('',file('sha256.min.js')); // works echo join('',file('test.js')); // works echo join('',file('style.css')); // works echo join('',file('jquery-1.4.4.min.js')); // never works // test with file get content //$file = file_get_contents('jquery-1.4.4.min.js'); //echo $file; // to activate to compress with PHP /*if(extension_loaded('zlib')){ob_end_flush();}*/ ?> Expected result: ---------------- I just want to andersted what's happen, and why the compression fail with this JS file ? -- Edit bug report at http://bugs.php.net/bug.php?id=53627&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53627&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53627&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53627&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53627&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53627&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53627&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53627&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53627&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53627&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53627&r=support Expected behavior: http://bugs.php.net/fix.php?id=53627&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53627&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53627&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53627&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53627&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53627&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53627&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53627&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53627&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53627&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53627&r=mysqlcfg

« previous php.bugs (#157377) next »