From:             adam at trachtenberg dot com
Operating system: Mac OS X / Linux
PHP version:      5CVS-2006-02-04 (CVS)
PHP Bug Type:     SOAP related
Bug description:  SOAPClient Compression Broken

Description:
------------
SOAPClient compression seems broken. I see two problems.

First, the code places the Accept-Encoding and Content-Encoding HTTP
headers before the POST /path HTTP/1.1 line, which is invalid HTTP. This
causes 400 errors.

I fixed this by moving the logic for this section further down in the
function. See this patch for more details:

http://www.trachtenberg.com/patches/soap_compression_patch.txt 

It works for me, but I did not verify this is a perfect fix.

Second, it seems impossible (or just not as documented) to trigger
compression of out-going requests. I don't understand how "level" can
evaluate to > 0 given the SOAP_COMPRESSION_* constants.

Do you need to also pass a gzip compression level (0-9) as part of the
compression bit field? This is not part of the online documentation, which
says you can do this:

$client = new SoapClient("some.wsdl",
  array('compression' => SOAP_COMPRESSION_ACCEPT |
SOAP_COMPRESSION_GZIP));

This evaluates to 0x20. Inside php_http.c in the make_http_soap_request
function, it then does:

if (zend_hash_find(Z_OBJPROP_P(this_ptr), "compression",
sizeof("compression"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) ==
IS_LONG) {
        int level = Z_LVAL_PP(tmp) & 0x0f;

  ...

  if (level > 0) {

0x20 & 0x0f evaluates to 0, so you never execute the last branch, and no
compression is used.

Furthermore, since level seems to be passed into the compression functions
as the gzip level, I don't know how that relates to the bit field.

I tries to verify this using the unit tests, but there are none for
SOAPClient and compression.


-- 
Edit bug report at http://bugs.php.net/?id=36283&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36283&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36283&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36283&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36283&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36283&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36283&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36283&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36283&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36283&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36283&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36283&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36283&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36283&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36283&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36283&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36283&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36283&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36283&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36283&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36283&r=mysqlcfg

Reply via email to