PHP :: Bug #61423 :: gzip compression fails
| Bug #61423 | gzip compression fails | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2012-03-17 02:01 UTC | Modified: | 2012-04-12 23:24 UTC |
|
||||||||||
| From: | borrible13th at gmx dot net | Assigned: | iliaa (profile) | |||||||||||
| Status: | Closed | Package: | SOAP related | |||||||||||
| PHP Version: | 5.4.0 | OS: | ALL | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2012-03-17 02:01 UTC] borrible13th at gmx dot net
Description:
------------
SOAP fails to compress with gzip encoding (compression level greater 0): it warns
"encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or
ZLIB_ENCODING_DEFLATE" and throws SoapFault with "SoapClient::__doRequest()
returned non string value".
Cause: Zlib introduces new constants ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP,
ZLIB_ENCODING_DEFLATE and redefines FORCE_GZIP as ZLIB_ENCODING_GZIP and
FORCE_DEFLATE as ZLIB_ENCODING_DEFLATE.
In php_http.c, line 263ff. the call to gzencode is prepared with an hard coded
magic number (1) for the gzip encoding: gzencode(data, level, 1).
It should be gzencode(data, level, FORCE_GZIP) or gzencode(data, level,
ZLIB_ENCODING_GZIP), because the magic number is now defined as 0x1f (31).
Test script:
---------------
new SoapClient($wsdl, array('soap_version' => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 1 ));
Expected result:
----------------
Call gzencode(data, level, FORCE_GZIP) (or gzencode(data, level,
ZLIB_ENCODING_GZIP)), so it returns compressed data.
Actual result:
--------------
gzencode(data, level, 1) is called, so it returns always false and warns "encoding
mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or
ZLIB_ENCODING_DEFLATE".
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2012-03-18 15:15 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
[2012-03-19 12:36 UTC] borrible13th at gmx dot net
[2012-03-20 00:16 UTC] borrible13th at gmx dot net
-Status: Closed +Status: Assigned
[2012-03-20 00:16 UTC] borrible13th at gmx dot net
[2012-03-22 13:54 UTC] iliaa@php.net
[2012-03-22 13:54 UTC] iliaa@php.net
-Status: Assigned +Status: Closed
[2012-03-22 15:52 UTC] borrible13th at gmx dot net
This bug is PHP 5.4 only, and not PHP 5.3! So, applying the bugfix on branch PHP-5.3 is totally wrong! Zlib introduces new constants ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, ZLIB_ENCODING_DEFLATE in PHP 5.4 and redefines the older constants of PHP 5.3 and older (FORCE_GZIP as ZLIB_ENCODING_GZIP and FORCE_DEFLATE as ZLIB_ENCODING_DEFLATE). Sorry for changing status again. --- Overview of constants in ext/zlib/php_zlib.h: PHP 5.3: CODING_GZIP 1 (registered as "FORCE_GZIP") CODING_DEFLATE 2 (registered as "FORCE_DEFLATE") PHP 5.4: PHP_ZLIB_ENCODING_RAW -0xf (registered as "ZLIB_ENCODING_RAW") PHP_ZLIB_ENCODING_GZIP 0x1f (31) (registered as "ZLIB_ENCODING_GZIP" and "FORCE_GZIP") PHP_ZLIB_ENCODING_DEFLATE 0x0f (15) (registered as "ZLIB_ENCODING_DEFLATE" and "FORCE_DEFLATE") [PHP_ZLIB_ENCODING_ANY 0x2f (47)][2012-03-22 15:52 UTC] borrible13th at gmx dot net
-Status: Closed +Status: Assigned
[2012-03-24 16:28 UTC] iliaa@php.net
-Status: Assigned +Status: Closed
[2012-03-26 13:28 UTC] borrible13th at gmx dot net
-Status: Closed +Status: Assigned
[2012-03-26 13:28 UTC] borrible13th at gmx dot net
[2012-04-12 23:24 UTC] borrible13th at gmx dot net
[2012-06-01 00:02 UTC] borrible13th at gmx dot net
[2014-10-07 23:27 UTC] stas@php.net
-Status: Assigned +Status: Closed