Bug #80953 [NEW]: gzencode(): stream error

From: Date: Mon, 12 Apr 2021 17:49:32 +0000
Subject: Bug #80953 [NEW]: gzencode(): stream error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233375@lists.php.net to get a copy of this message
From:             tessus
Operating system: Linux
PHP version:      7.4.16
Package:          Zlib related
Bug Type:         Bug
Bug description:gzencode(): stream error

Description:
------------
I've tested it with PHP 7.4.15 and PHP 7.4.16.

I get errors with zlib related functions. e.g. for the test script
below, I get the following warning, which should be an error in the
first place, because the resulting file is invalid.

PHP Warning:  gzencode(): stream error in t.php on line 3

It happens with cli and php-fpm. I do have read/write access to the
directory where the file bigfile.txt is located.

I've tested this with 7.3.27 and it works without issues. I compile PHP
myself and there were no errors in config.log, nor during compilation.
configure stated for both PHP releases that zlib was found and ok to
use.

Test script:
---------------
<?php
$data = implode("", file("bigfile.txt"));
$gzdata = gzencode($data, 9);
$fp = fopen("bigfile.txt.gz", "w");
fwrite($fp, $gzdata);
fclose($fp);
?>

Expected result:
----------------
The file should be compressed and the result should be a valid
bigfile.txt.gz

Actual result:
--------------
A file bigfile.txt.gz is created with 0 bytes.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=80953&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80953&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80953&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80953&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80953&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80953&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80953&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80953&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80953&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80953&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80953&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80953&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80953&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80953&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80953&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80953&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80953&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80953&r=mysqlcfg


Thread (25 messages)

« previous php.bugs (#233375) next »