Bug #80953 [Opn]: gzencode(): stream error
| From: | tessus@php.net | Date: | Tue, 13 Apr 2021 22:17:53 +0000 |
| Subject: | Bug #80953 [Opn]: gzencode(): stream error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233413@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80953&edit=1
ID: 80953
Updated by: tessus@php.net
Reported by: tessus@php.net
Summary: gzencode(): stream error
Status: Open
Type: Bug
Package: Zlib related
Operating System: Linux
PHP Version: 7.4.16
Block user comment: N
Private report: N
New Comment:
Hmm, you didn't tell me that is was a c function. Just from looking at the name I can't
determine that. Anyway, we got the proper output from phpinfo().
I haven't found it in LD_LIBRARY_PATH. I'm running Fedora 20 and haven't updated any
yum packages for more than 4 years, because I compile everything myself anyway. And I do know that I
haven't installed nor compilled 1.1.3 ever.
I really have no idea where this should be coming from. I'll try to replace the config.m4 with
the one from 7.3. Let's see if that works.
Previous Comments:
------------------------------------------------------------------------
[2021-04-13 21:56:35] cmb@php.net
> php > echo zlibVersion();
zlibVersion() is a C function. :)
> The output from pkgconfig looks ok:
Yes. However, I assume that the old zlib version is somewhere in
your LD_LIBRARY_PATH, or so. Sorry, I'm usually working on
Windows, so I can't help any further, but I don't think this is a
PHP bug.
------------------------------------------------------------------------
[2021-04-13 20:27:34] tessus@php.net
Hmmm, still not working, but we got the output from phpinfo anyway.
php > echo zlibVersion();
PHP Warning: Uncaught Error: Call to undefined function zlibVersion() in php shell code:1
The output from pkgconfig looks ok:
# pkg-config --print-provides zlib
zlib = 1.2.8
------------------------------------------------------------------------
[2021-04-13 16:45:38] cmb@php.net
> zlib_version() tells me undefined function in the php shell.
Oh indeed, the proper spelling is zlibVersion(), and that function
is used to retrieve the linked version[1]. To my knowlege, PHP does
not (and never did) bundle zlib, so this old version must be somewhere
on your system. I assume that the difference between PHP 7.3 and 7.4
is due to build system changes; 7.4 uses pkg-config to detect zlib[2]
while 7.3 manually searched for the lib in the usual places[3].
Anyhow, what does
pkg-config --print-provides zlib
report?
[1] <https://github.com/php/php-src/blob/php-7.4.16/ext/zlib/zlib.c#L1593>
[2] <https://github.com/php/php-src/blob/php-7.4.16/ext/zlib/config0.m4>
[3] <https://github.com/php/php-src/blob/php-7.3.27/ext/zlib/config0.m4>
------------------------------------------------------------------------
[2021-04-13 15:58:19] tessus@php.net
zlib_version() tells me undefined function in the php shell. But:
php > echo ZLIB_VERSION;
1.2.8
But then I looked at the phpinfo() output and found something very strange:
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.8
Linked Version => 1.1.3
My zlib version on the system is 1.2.8. There is nowhere a 1.1.3 in any of my lib directories.
And on PHP 7.3 both match and say 1.2.8.
I can assure you that there is no 1.1.3 of zlib on my system and I have no idea where this is coming
from. ldd for my php 7.4 binary shows:
libz.so.1 => /usr/lib64/libz.so.1 (0x00000036d3200000)
and ls -la /usr/lib64/libz.so.1 shows: /usr/lib64/libz.so.1 -> libz.so.1.2.8
I just compiled 7.3 again and all works. I compile 7.4 and same problem. It's very puzzling,
since I certainly haven't installed libz 1.1.3, nor is it present in any of my lib paths. (Why
would I install an older version?) Also, in that case 7.3, would pick it up too.
We have a mystery on our hands.
The only logical explanation would be that PHP 7.4 bundles 1.1.3 and statically links it.
------------------------------------------------------------------------
[2021-04-13 11:14:39] cmb@php.net
> PHP Warning: gzencode(): stream error in t.php on line 3
This is apparently caused by deflateInit2()[1] returning
Z_STREAM_ERROR. The zlib manual[2] states:
| deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
| not enough memory, Z_STREAM_ERROR if a parameter is invalid (such
| as an invalid method), or Z_VERSION_ERROR if the zlib library
| version (zlib_version) is incompatible with the version assumed by
| the caller (ZLIB_VERSION).
Does zlib_version() match ZLIB_VERSION for you?
[1] <https://github.com/php/php-src/blob/php-7.4.16/ext/zlib/zlib.c#L346>
[2] <https://zlib.net/manual.html>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80953
--
Edit this bug report at https://bugs.php.net/bug.php?id=80953&edit=1