Bug #79549 [NEW]: PHP-FPM sends wrong headers to the web server

From: Date: Thu, 30 Apr 2020 23:18:13 +0000
Subject: Bug #79549 [NEW]: PHP-FPM sends wrong headers to the web server
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226859@lists.php.net to get a copy of this message
From: morozov at tut dot by Operating system: Linux PHP version: 7.4.5 Package: opcache Bug Type: Bug Bug description:PHP-FPM sends wrong headers to the web server Description: ------------ Under certain circumstances which I cannot currently isolate, PHP-FPM responds to the webserver (Apache) with certain invalid headers that result in a 500 response from apache. The issue is only reproducible in a proprietary application. There are certain criteria I was able to identify which make the issue trigger. If I remove any of them, the issue goes away: 1. Opcache enabled. 2. header('Expires:'); header('Pragma:'); // note the absence of the value which is probably invalid. Sometimes the issue is also reproducible even w/o invalid headers 3. Response length. With all other parameters the same, a "[]" json response doesn't cause the issue but a valid 180-bytes response does. 4. Some seemingly unrelated function calls like file_get_contents(). Actual result: -------------- Apache response: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>500 Internal Server Error</title> </head><body> <h1>Internal Server Error</h1> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.</p> <p>More information about this error may be available in the server error log.</p> <p>Additionally, a 304 Not Modified error was encountered while trying to use an ErrorDocument to handle the request.</p> <hr> <address>Apache/2.4.41 (Ubuntu) Server at sugarcrm.local Port 80</address> </body></html> Apache logs: [Thu Apr 30 14:57:39.470700 2020] [http:error] [pid 73344:tid 140477684762368] [client 127.0.0.1:35104] AH02429: Response header name '0\xd5e\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 14:57:39.725176 2020] [http:error] [pid 73311:tid 140478498461440] [client 127.0.0.1:35016] AH02429: Response header name '\x90\x84f\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 15:06:12.065188 2020] [http:error] [pid 73344:tid 140478162917120] [client 127.0.0.1:39432] AH02429: Response header name '0\x85f\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 15:14:17.448112 2020] [http:error] [pid 73344:tid 140478869321472] [client 127.0.0.1:43298] AH02429: Response header name 'p\x84f\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 15:43:12.482083 2020] [http:error] [pid 73344:tid 140478877714176] [client 127.0.0.1:57656] AH02429: Response header name '@\x84f\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 15:50:02.294075 2020] [http:error] [pid 73311:tid 140478246811392] [client 127.0.0.1:60500] AH02429: Response header name 'P\x84f\xc8' contains invalid characters, aborting request, referer: ... [Thu Apr 30 15:50:05.837520 2020] [http:error] [pid 73311:tid 140478230025984] [client 127.0.0.1:33090] AH02429: Response header name ' \x84f\xc8' contains invalid characters, aborting request, referer: ... -- Edit bug report at https://bugs.php.net/bug.php?id=79549&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79549&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79549&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79549&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79549&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79549&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79549&r=support Expected behavior: https://bugs.php.net/fix.php?id=79549&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79549&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79549&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79549&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79549&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79549&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79549&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79549&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79549&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79549&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79549&r=mysqlcfg

« previous php.bugs (#226859) next »