Bug #75776 [NEW]: compression filters on stdout not working any more
| From: | shestero at meta dot ua | Date: | Mon, 08 Jan 2018 03:27:17 +0000 |
| Subject: | Bug #75776 [NEW]: compression filters on stdout not working any more | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-213415@lists.php.net to get a copy of this message | ||
From: shestero at meta dot ua
Operating system: Debian
PHP version: 7.0.27
Package: *Compression related
Bug Type: Bug
Bug description:compression filters on stdout not working any more
Description:
------------
I used this way to produce compressed output for years but now it return
zero-output without any errors anywhere.
Registered Stream Filters: zlib.*, bzip2.*, convert.iconv.*, mcrypt.*,
mdecrypt.*, string.rot13, string.toupper, string.tolower,
string.strip_tags, convert.*, consumed, dechunk
My configure parameters:
'./configure' '--with-openssl' '--with-ssl=/usr/bin/openssl'
'--with-ssl-lib=/usr/lib/x86_64-linux-gnu'
'--with-libdir=lib/x86_64-linux-gnu' '--with-bz2' '--enable-exif'
'--with-gd' '--with-mcrypt' '--with-mysql'
'--with-mysql-sock'
'--enable-sockets' '--enable-zip' '--with-apxs2=/usr/bin/apxs2'
'--with-config-file-path=/var/lib/apache2/conf' '--with-jpeg-dir'
'--enable-gd-native-ttf' '--with-xmlrpc' '--with-freetype-dir'
'--with-zlib' '--with-zlib-dir' '--enable-maintainer-zts'
'--with-tsrm-pthreads' '--with-mysqli' '--enable-mbstring'
'--with-pdo-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-curl'
'--enable-memcache'
PS Output mute as I adding compression filters. string.toupper and
string.tolower work!
Test script:
---------------
error_reporting(E_ALL); ini_set("display_errors", 1);
if (true)
{
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=main.csv.bz2");
header("Content-Type: application/x-bzip2");
header("Content-Transfer-Encoding: binary");
}
else
{
header("Content-Type: application/csv");
header("Content-Disposition: attachment;Filename=main.csv");
}
$bz = fopen('php://output', 'w');
fwrite($bz,"sdfgdfg"); // output such way
...
fflush($bz);
fclose($bz);
stream_filter_append($bz, 'convert.iconv.UTF-8/CP1251//TRANSLIT'); //
ok
if (true)
{
$param = array('blocks' => 6, 'work' => 0); // for bzip2
$ok = stream_filter_append($bz, 'bzip2.compress',
STREAM_FILTER_WRITE, $param);
// $param = array('level' => 6, 'window' => 15, 'memory'
=> 9); //
for gzip
//$ok = stream_filter_append($bz, 'zlib.deflate');//,
STREAM_FILTER_WRITE, $param);
if ($ok===false)
{
die("Cannot stream_filter_append( 'bzip2.compress' ) !");
}
}
Expected result:
----------------
error or some output as usual
Actual result:
--------------
browser saves zero-size file.
--
Edit bug report at https://bugs.php.net/bug.php?id=75776&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75776&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75776&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75776&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75776&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75776&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75776&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75776&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75776&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75776&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75776&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75776&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75776&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75776&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75776&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75776&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75776&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75776&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75776&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75776&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75776&r=mysqlcfg