|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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".
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
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)]