php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54333 ini_set zlib.output_compression On returns false
Submitted: 2011-03-21 09:35 UTC Modified: 2011-03-21 09:45 UTC
From: valentin at 1h dot com Assigned:
Status: Not a bug Package: Zlib related
PHP Version: 5.2.17 OS: CentOS 5.5 32bit
Private report: No CVE-ID: None
 [2011-03-21 09:35 UTC] valentin at 1h dot com
Description:
------------
PHP is compiled with the following options:

System => Linux serv01.testmachine.com 2.6.28.5-grsec-sg2 #6 SMP Fri Feb 20 02:45:11 CST 2009 i686
Build Date => Mar 21 2011 10:04:49
Configure Command =>  './configure'  '--prefix=/usr/local/php52' '--mandir=/usr/man' '--with-config-file-path=/usr/local/php52/lib' '--with-config-file-scan-dir=/usr/local/php52/etc' '--with-pear=/usr/local/php52/pear' '--with-litespeed' '--enable-discard-path' '--enable-sigchild' '--disable-fastcgi' '--enable-magic-quotes' '--with-db4' '--disable-force-cgi-redirect' '--disable-ipv6' '--with-openssl' '--with-zlib' '--with-zlib-dir' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--with-curl' '--with-curlwrappers' '--enable-exif' '--enable-ftp' '--with-kerberos' '--with-gd' '--with-pspell' '--with-libedit' '--with-jpeg-dir' '--with-png-dir' '--with-xpm-dir' '--with-freetype-dir' '--with-t1lib' '--enable-gd-native-ttf' '--with-ttf' '--with-gettext' '--with-imap' '--with-imap-ssl' '--with-ldap' '--with-ldap-sasl' '--enable-mbstring' '--with-mcrypt' '--with-mhash' '--with-mysql' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli' '--with-ncurses' '--enable-pcntl' '--with-pdo-mysql' '--with-pdo-pgsql' '--with-pgsql' '--with-readline' '--enable-shmop' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--enable-soap' '--enable-sockets' '--enable-sqlite-utf8' '--enable-wddx' '--with-tidy' '--with-xmlrpc' '--enable-zip' '--with-xsl=/usr' '--with-libxml-dir=/usr' '--enable-zend-multibyte'

In the master php.ini file zlib.output_compression is set to off as reported by phpinfo();

zlib.output_compression => Off => Off

Many applications are using the code shown in the test script to initiate the compression of their headers.

With PHP 5.2.17 from the stable repo (snaps too!) return false on the following line:

$r = @ini_set('zlib.output_compression', 'On');

Even it is returning false zlib.output_compression is actually enabled and when it reaches ob_start('ob_gzhandler'); because of the false results the following error is produced:

[21-Mar-2011 03:18:43] PHP Warning:  ob_start() [<a href='ref.outcontrol'>ref.outcontrol</a>]: output handler 'ob_gzhandler' conflicts with 'zlib output compression' in /home/jeepchic/public_html/header.php on line 767

Test case script I provided here works just fine on PHP 5.2.9.



Test script:
---------------
<?
if (function_exists('gzopen')) {
     $r = @ini_set('zlib.output_compression', 'On');
     $r2 = @ini_set('zlib.output_compression_level', '3');
     if (!$r || !$r2) {
                echo "Fail\n";
         ob_start('ob_gzhandler');
     } else {
                echo "success\n";
        }
} else {
        echo "Fallback\n";
     ob_start('ob_gzhandler');
}
?>


Expected result:
----------------
echo "success\n";

Actual result:
--------------
echo "Fail\n";

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-21 09:45 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-03-21 09:45 UTC] aharvey@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

ini_set() returns the previous value of the configuration setting:
since this was off, FALSE is returned.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 01 05:01:24 2020 UTC