Bug #73037 [Fbk->Asn]: SoapServer reports Bad Request when gzipped

From: Date: Mon, 19 Sep 2016 07:49:06 +0000
Subject: Bug #73037 [Fbk->Asn]: SoapServer reports Bad Request when gzipped
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204119@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73037&edit=1

 ID:                 73037
 User updated by:    maggus dot staab at googlemail dot com
 Reported by:        maggus dot staab at googlemail dot com
 Summary:            SoapServer reports Bad Request when gzipped
-Status:             Feedback
+Status:             Assigned
 Type:               Bug
 Package:            SOAP related
 Operating System:   Ubuntu14LTS
 PHP Version:        5.6.25
 Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

Thx anatol for your patch!

I am not sure what the easiest way is to get a custom php7 build running with this patch included.

Do I have to build/make/compile it on my machine?


Previous Comments:
------------------------------------------------------------------------
[2016-09-16 13:56:46] ab@php.net

Markus, could you check the attached patch please? Besides your actual repro case, with the data
size < 8k, > 16k and the rest of your app.

Thanks.

------------------------------------------------------------------------
[2016-09-16 13:52:51] ab@php.net

The following patch has been added/updated:

Patch Name: bug73037.try.2.patch
Revision:   1474033971
URL:        https://bugs.php.net/patch-display.php?bug=73037&patch=bug73037.try.2.patch&revision=1474033971

------------------------------------------------------------------------
[2016-09-15 15:42:03] ab@php.net

I repro the case with gzip compression. But from what i could debug, it looks rather like an issue
with the exact case, not with the streams. The compressed data arrives, but the wrapping stream
doesn't eat all the uncompressed buffer. Right now it looks like an issue with XML parser in
conjunction with streams. 

The internal stream buffer is 8192 bytes, any data smaller than that seems to come through. Also, a
simple snippet without XML parser works, too. Like

$fd = fopen("php://input", "rb");
stream_filter_append($fd, 'zlib.inflate', STREAM_FILTER_READ, array('window'
=> 0x2f));

$in = "";
while (!feof($fd)) {
        $in .= fread($fd, 1024);
}

fclose($fd);

I was able to track this down to PHP 5.5 already. Digging further on this.

Bob, i currently don't see, how the other snippet is connected to this. Works in both 5 and 7
on my side. Maybe it's also about buffered enclosed stream. Didn't try anything else, but
google seems to deliver the whole page, though always different size.

Thanks.

------------------------------------------------------------------------
[2016-09-12 12:17:54] maggus dot staab at googlemail dot com

I can re-produce the issue with opcache, blackfire disabled. same issue without those extensions.

------------------------------------------------------------------------
[2016-09-09 17:53:43] bwoebi@php.net

I had looked at the issue and it's not related to any extension (only zlib, soap and libxml
code is ever called).

There's something fishy when _php_stream_read() is called recursively though.

Thus simple code like:

class simple_filter extends php_user_filter {
    function filter($in, $out, &$consumed, $closing) {
        while ($bucket = stream_bucket_make_writeable($in)) {
            $consumed += $bucket->datalen;
            stream_bucket_append($out, $bucket);
        }
        return PSFS_PASS_ON;
    }
}
stream_filter_register("simple", "simple_filter");
file_get_contents("php://filter/read=simple/resource=http://google.com");

is also failing in PHP 7. (works flawlessly with PHP 5.)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=73037


--
Edit this bug report at https://bugs.php.net/bug.php?id=73037&edit=1


Thread (21 messages)

« previous php.bugs (#204119) next »