Bug #79549 [Ver]: PHP-FPM sends invalid headers '0\xd5e\xc8' to the web server

From: Date: Fri, 01 May 2020 05:41:16 +0000
Subject: Bug #79549 [Ver]: PHP-FPM sends invalid headers '0\xd5e\xc8' to the web server
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226865@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79549&edit=1

 ID:                 79549
 User updated by:    morozov at tut dot by
 Reported by:        morozov at tut dot by
 Summary:            PHP-FPM sends invalid headers '0\xd5e\xc8' to the
                     web server
 Status:             Verified
 Type:               Bug
 Package:            opcache
 Operating System:   Linux
 PHP Version:        7.4.5
 Block user comment: N
 Private report:     N

 New Comment:

> Would you be able to try running on other PHP versions? I suggest 7.4.1 and a recent 7.3.

I tried 7.4.1 (also reproducible) and 7.3.17 (not reproducible). Please see the dumps in the updated
gist.

> Separately, notice that this is a 304 but it comes with some output. If your application is
> responsible for emitting that (and given the Content-Length header I think it is), it's
> incorrect behavior that you should look into when you have the time.

Definitely. Thank you for pointing that out.


Previous Comments:
------------------------------------------------------------------------
[2020-05-01 04:20:30] requinix@php.net

The important bit being

20:47:31.786 >>> process php-fpm [125706 -> 73344] len 152(152)
~Status: 304 Not Modified
X-Powered-By: PHP/7.4.5
Cache-Control: max-age=0, private
j
Pragma:
Content-Length: 2

ort

I've confirmed that whole thing is indeed 152 bytes.

You can take down the gist if you want, but just in case, please dump one of these outputs to a file
and hang onto it in case it's useful.

So yeah, definitely screwy: there's leading garbage before the headers, clearly something weird
happened to the Expires, and there's more garbage before the body.

Would you be able to try running on other PHP versions? I suggest 7.4.1 and a recent 7.3.


Separately, notice that this is a 304 but it comes with some output. If your application is
responsible for emitting that (and given the Content-Length header I think it is), it's
incorrect behavior that you should look into when you have the time.

------------------------------------------------------------------------
[2020-05-01 03:54:33] morozov at tut dot by

Please see the dump at https://gist.github.com/morozov/bfe35ea3298681cf75b6ba54d67d2575

Right before the empty Pragma: header there was supposed to be the Expires: one.

------------------------------------------------------------------------
[2020-05-01 01:44:53] requinix@php.net

I don't know, haven't done it before myself. Some quick leads for you to follow:
https://github.com/mechpen/sockdump
https://superuser.com/questions/484671/can-i-monitor-a-local-unix-domain-socket-like-tcpdump
https://superuser.com/questions/23180/whats-the-easiest-way-to-sniff-tcp-traffic-data-on-linux

------------------------------------------------------------------------
[2020-05-01 01:35:32] morozov at tut dot by

What's the recommended way of intercepting traffic between a web server and PHP FPM? I use a
local Unix socket for development. Should I switch to TCP/IP and use something like Wireshark?

------------------------------------------------------------------------
[2020-05-01 00:59:40] requinix@php.net

Is there any way you can dump the full response from php-fpm to somewhere you can read it?

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


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=79549


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


Thread (8 messages)

« previous php.bugs (#226865) next »