1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-23 22:22:59 +02:00

test_environment.php : check for output_handler

config.php : disable output_handler (along with zlib.output_handler)
This commit is contained in:
Steve Clay
2009-10-16 20:13:25 +00:00
parent bd1df7734b
commit 7a0fe29678
2 changed files with 19 additions and 11 deletions

View File

@@ -154,3 +154,4 @@ $min_libPath = dirname(__FILE__) . '/lib';
// try to disable output_compression (may not have an effect) // try to disable output_compression (may not have an effect)
ini_set('zlib.output_compression', '0'); ini_set('zlib.output_compression', '0');
ini_set('output_handler', '');

View File

@@ -3,12 +3,16 @@
if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) { if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
// called directly // called directly
if (isset($_GET['getOutputCompression'])) { if (isset($_GET['getOutputCompression'])) {
echo (int)ini_get('zlib.output_compression'); echo (int)(
ini_get('zlib.output_compression')
|| ini_get('output_handler') === 'ob_gzhandler'
);
exit(); exit();
} }
if (isset($_GET['hello'])) { if (isset($_GET['hello'])) {
// try to disable (may not work) // try to disable (may not work)
ini_set('zlib.output_compression', '0'); ini_set('zlib.output_compression', '0');
ini_set('output_handler', '');
echo 'World!'; echo 'World!';
exit(); exit();
} }
@@ -56,10 +60,6 @@ function test_environment()
echo "!WARN: environment : Local HTTP request failed. Testing cannot continue.\n"; echo "!WARN: environment : Local HTTP request failed. Testing cannot continue.\n";
return; return;
} }
if ('1' === $oc) {
echo "!WARN: environment : zlib.output_compression is enabled in php.ini"
. " or .htaccess.\n";
}
$fp = fopen($thisUrl . '?hello=1', 'r', false, stream_context_create(array( $fp = fopen($thisUrl . '?hello=1', 'r', false, stream_context_create(array(
'http' => array( 'http' => array(
@@ -79,7 +79,8 @@ function test_environment()
break; break;
} }
} }
if ($passed && stream_get_contents($fp) !== 'World!') { $streamContents = stream_get_contents($fp);
if ($passed && $streamContents !== 'World!') {
$passed = false; $passed = false;
} }
assertTrue( assertTrue(
@@ -88,11 +89,17 @@ function test_environment()
); );
fclose($fp); fclose($fp);
if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
if (! $passed) { if (! $passed) {
echo "\nReturned content should be 6 bytes and not HTTP encoded.\n" echo "\nReturned content should be 6 bytes and not HTTP encoded.\n"
. "Headers returned by: {$thisUrl}?hello=1\n\n"; . "Headers returned by: {$thisUrl}?hello=1\n";
var_export($meta['wrapper_data']); var_export($meta['wrapper_data']);
echo "\nContent body: ";
var_export($streamContents);
echo "\n\n";
if ('1' === $oc) {
echo "!NOTE: environment : zlib.output_compression='On' OR "
. " output_handler='ob_gzhandler' in php.ini or .htaccess.\n";
} }
} }
} }