doc-en
doc-en copied to clipboard
gzuncompress() unable to handle data from gzcompress($s,1,ZLIB_ENCODING_RAW);
Description
The following code:
<?php
$data="test";
var_dump(gzuncompress(gzcompress($data,1, ZLIB_ENCODING_DEFLATE)));
var_dump(gzuncompress(gzcompress($data,1,ZLIB_ENCODING_RAW)));
Resulted in this output:
string(4) "test"
Warning: gzuncompress(): data error in /in/Ms5o8 on line 4
bool(false)
But I expected this output instead:
string(4) "test"
string(4) "test"
PHP Version
8.1.11
Operating System
No response
This is to be expected; gzuncompress() is for deflated input, while gzinflate() is for raw encoded input: https://3v4l.org/iukbV. This is not sufficiently documented, though.