Bug #81000 [Com]: syntax error in php://input

From: Date: Thu, 29 Apr 2021 09:57:48 +0000
Subject: Bug #81000 [Com]: syntax error in php://input
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233616@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81000&edit=1

 ID:                 81000
 Comment by:         ahirsch29 at gmail dot com
 Reported by:        ahirsch29 at gmail dot com
 Summary:            syntax error in php://input
 Status:             Duplicate
 Type:               Bug
 Package:            FPM related
 Operating System:   Alpine Linux v3.13.5
 PHP Version:        8.0.3
 Block user comment: N
 Private report:     N

 New Comment:

For giving more insights into the infra structure:
The application is hosted within AKS and there are two containers:
1) httpd:2.4.46-alpine
directs to php-fpm via Proxy:
<VirtualHost *:80>
  ProxyPassMatch ^/(.*\.php(/.*)?)$
fcgi://ottofischer-<environment>-php-fpm:9000/app/source/$1
  DirectoryIndex /index.php index.php
  DocumentRoot "/app/source"
  RequestHeader set X-Forwarded-server https
  <Directory "/app/source">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    DirectoryIndex index.php
  </Directory>
</VirtualHost>


2) php8.0.3-alpine3.13
All configs are standard / using php.ini-production as php.ini.

listen = 127.0.0.1:9000

Port 9000 is published internally, but not externally:
apiVersion: v1
kind: Service
metadata:
  name: {{ .Chart.Name }}-php-fpm
spec:
  selector:
    app: {{ .Chart.Name }}-php-fpm
  ports:
      - name: php-fpm
        protocol: TCP
        port: 9000
        targetPort: 9000


Previous Comments:
------------------------------------------------------------------------
[2021-04-29 08:39:43] requinix@php.net

Sounds like bug #80385.

------------------------------------------------------------------------
[2021-04-29 08:35:04] ahirsch29 at gmail dot com

changed Package

------------------------------------------------------------------------
[2021-04-29 08:34:06] ahirsch29 at gmail dot com

Description:
------------
FastCGI sent in stderr: "Parse error: syntax error, unexpected identifier "version"
in php://input on line 1" when sending POST with the following POST-Data:
<?xml version="1.0" encoding="UTF-8"?>
<cXML>
</cXML>

If I am sending the following data to the script:
<?php echo 3 + 3; ?>
<test>test</test>

I am getting this result:
6
<test>test</test>

Somehow the XML get's interpreted without any logic within the script that is called.

Rebooting the docker container (8.0.3-fpm-alpine3.13) will solve the problem for a while - but after
a couple hours the problem appears again.

Currently OpCache is enabled - also tryed to disable it.

Log does not show anything special:
10.240.0.100 - 29/Apr/2021:08:26:58 +0000 "POST /index.php" 200

Even if i place invalid code into the index.php:
<?php
thisShouldNotWork();

I am getting this result:
6
<test>test</test><br />
<b>Fatal error</b>:  Uncaught Error: Call to undefined function thisShouldNotWork() in
/app/source/index.php:2
Stack trace:
#0 {main}
  thrown in <b>/app/source/index.php</b> on line <b>2</b><br />

But the log shows a successful POST - even a excaption was thrown:
10.240.0.100 - 29/Apr/2021:08:29:28 +0000 "POST /index.php" 200


There might be a related bug for 7.x: https://bugs.php.net/bug.php?id=80378

Test script:
---------------
The script (index.php) contains nothing but a die();:
<?php
die();

There is no logic at all within this script so I am asuming this error somewhere else.



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



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


Thread (4 messages)

« previous php.bugs (#233616) next »