From: maggus dot staab at googlemail dot com
Operating system: Ubuntu14LTS
PHP version: 5.6.25
Package: SOAP related
Bug Type: Bug
Bug description:SoapServer reports Bad Request when gzipped
Description:
------------
SoapServer->handle() reports a bad-request when issuing a request with
gzip.
triggering the very same request without gzip encoding works as
expected.
SoapServer seems not to be able to read and parse the posted XML body.
the error is reproducible on php 5.6.23 and 7.0.10.
the testscript works (both in gzip and non-gzip) on php 5.4.45 (on
ubuntu12 lts)
here some detail of the involved php versions:
mstaab@mst14:~$ php -v
PHP 7.0.10-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.10-2+deb.sury.org~trusty+1, Copyright (c)
1999-2016, by Zend Technologies
with blackfire v1.12.0, https://blackfire.io, by Blackfireio
Inc.
mstaab@mst14:~$ php5 -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend
Technologies
with Zend Debugger v8.0.0, Copyright (c) 1999-2014, by Zend
Technologies
with blackfire v1.12.0, https://blackfire.io, by Blackfireio
Inc.
mstaab@vStaab12:~$ php -v
PHP 5.4.45-3+deb.sury.org~precise+1 (cli) (built: Jan 7 2016 15:32:17)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Zend Debugger v6.0.0, Copyright (c) 1999-2013, by Zend
Technologies
with blackfire v1.11.1, https://blackfire.io, by Blackfireio
Inc.
Test script:
---------------
mstaab@mst14:~$ cat server.php
<?php
$s = new SoapServer(NULL, array('uri' =>
'http://localhost/server.php'));
$s->setObject(new stdclass());
$s->handle();
mstaab@mst14:~$ cat postgz.sh
#!/bin/bash
curl \
-H "Content-Type: application/soap+xml; charset=UTF-8" \
-H "Accept: application/soap+xml, application/dime,
multipart/related, text/*" \
-H 'SOAPAction: "urn:adressen#adressen#SetAda"' \
-H 'Content-Encoding: gzip' \
--data-binary @<(cat cd_catalog.xml | gzip) \
-X POST http://localhost:8000/server.php
mstaab@mst14:~$ cat post.sh
#!/bin/bash
curl \
-H "Content-Type: application/soap+xml; charset=UTF-8" \
-H "Accept: application/soap+xml, application/dime,
multipart/related, text/*" \
-H 'SOAPAction: "urn:adressen#adressen#SetAda"' \
--data-binary @<(cat cd_catalog.xml) \
-X POST http://localhost:8000/server.php
cd_catalog.xml can be found at
https://gist.github.com/staabm/fc96933585c11fe277b658c62c877345
you just need to start the builtin-webserver using php -S localhost:8000
and trigger post.sh respec. postgz.sh
Expected result:
----------------
mstaab@vStaab12:~$ ./post.sh
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>Function
'CATALOG't
exist</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
mstaab@vStaab12:~$ ./postgz.sh
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>Function
'CATALOG't
exist</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
Actual result:
--------------
mstaab@mst14:~$ ./post.sh
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>Function
'CATALOG't
exist</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>
mstaab@mst14:~$ ./postgz.sh
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Bad
Request</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
--
Edit bug report at https://bugs.php.net/bug.php?id=73037&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73037&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73037&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73037&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73037&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73037&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73037&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73037&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73037&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73037&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73037&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73037&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73037&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73037&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73037&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73037&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73037&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73037&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73037&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73037&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73037&r=mysqlcfg