php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61423 gzip compression fails
Submitted: 2012-03-17 02:01 UTC Modified: 2012-04-12 23:24 UTC
Votes:44
Avg. Score:4.9 ± 0.4
Reproduced:41 of 43 (95.3%)
Same Version:19 (46.3%)
Same OS:38 (92.7%)
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 commitsRelated reports
 [2012-03-18 15:15 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [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
Can't see a bugfix in the source code whether in the branch for 5.4 or in the 
trunk! The magic number (1) is still hard coded.
Do I miss something?
 [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
Changed status to "Assigned" due to last comment.
 [2012-03-22 13:16 UTC] iliaal@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-22 13:16 UTC] iliaal@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-22 13:17 UTC] iliaal@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-22 13:47 UTC] iliaa@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f9f631fb765dc08e3d62073b6eb35ce1b11db0e4
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-22 13:48 UTC] iliaa@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f9f631fb765dc08e3d62073b6eb35ce1b11db0e4
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-22 13:54 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

There was an issue with the fix push, all good now.
 [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-24 16:28 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [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
"Merge branch 'PHP-5.3' into PHP-5.4" (7a1c765385) reverted this bugfix! :(
Please re-commit it to branch PHP-5.4 only. Thanks in advance!
 [2012-03-29 04:24 UTC] iliaa@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f9f631fb765dc08e3d62073b6eb35ce1b11db0e4
Log: Fixed bug #61423 (gzip compression fails).
 [2012-03-29 04:24 UTC] iliaal@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 [2012-04-03 12:47 UTC] iliaa@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9c5ae9954f40c82ee98038ce3e528185090e4ba1
Log: Fixed bug #61423 (gzip compression fails).
 [2012-04-03 12:49 UTC] iliaa@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9c5ae9954f40c82ee98038ce3e528185090e4ba1
Log: Fixed bug #61423 (gzip compression fails).
 [2012-04-12 23:24 UTC] borrible13th at gmx dot net
Please cherry-pick commit 9c5ae99 into branch 5.4.1. The bugfix is still missing 
there, although the bug is listed as fixed in https://github.com/php/php-
src/blob/PHP-5.4.1/NEWS#L85 (line 85).
 [2012-06-01 00:02 UTC] borrible13th at gmx dot net
What's the current status?
 [2014-10-07 23:27 UTC] stas@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=9c5ae9954f40c82ee98038ce3e528185090e4ba1
Log: Fixed bug #61423 (gzip compression fails).
 [2014-10-07 23:27 UTC] stas@php.net
-Status: Assigned +Status: Closed
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=f9f631fb765dc08e3d62073b6eb35ce1b11db0e4
Log: Fixed bug #61423 (gzip compression fails).
 [2014-10-07 23:28 UTC] stas@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 [2014-10-07 23:38 UTC] stas@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=9c5ae9954f40c82ee98038ce3e528185090e4ba1
Log: Fixed bug #61423 (gzip compression fails).
 [2014-10-07 23:39 UTC] stas@php.net
Automatic comment on behalf of iliaa
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=f9f631fb765dc08e3d62073b6eb35ce1b11db0e4
Log: Fixed bug #61423 (gzip compression fails).
 [2014-10-07 23:39 UTC] stas@php.net
Automatic comment on behalf of iliaal
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=b4aea52682a6e7a8f0e2a7638ba37145cb6bf16d
Log: Fixed bug #61423 (gzip compression fails).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC