php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39188 reading php://input hangs with IIS
Submitted: 2006-10-18 19:01 UTC Modified: 2009-09-09 01:00 UTC
Votes:7
Avg. Score:4.4 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:4 (57.1%)
From: php at nineberry dot de Assigned: dmitry (profile)
Status: No Feedback Package: IIS related
PHP Version: 5.1.6 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at nineberry dot de
New email:
PHP Version: OS:

 

 [2006-10-18 19:01 UTC] php at nineberry dot de
Description:
------------
Posting to a php script makes the script hang reading from php://input on a server with IIS 6.0 / CGI

Code works fine on Apache both on Linux and Win32.

Code also works as expected, when "text/plain" is used as enctype in the HTML Form.

Maybe related to #38488 ?
Maybe stdin is not opened as binary any longer?

Reproduce code:
---------------
HTML Form:

<html>
<body>
  <form method="POST" action="1.php">
    <input type="hidden" name="test" value="yyyy">
    <input type="submit">
  </form>
</body>
</html>

PHP Code in 1.php:

<?php
   // Read 1 char
   $f = fopen('php://input', 'rb');
   $inpData = fread($f, 1);
   fclose ($f);
   
   echo($inpData);
   echo("Done");
?>



Expected result:
----------------
Expected Output:

tDone

Actual result:
--------------
Constantly loading, CGI timeout after some minutes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-18 19:10 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-10-18 19:19 UTC] php at nineberry dot de
Can't test. Can't access server but by FTP.
 [2006-10-23 05:26 UTC] dmitry@php.net
The provided example works fine (at least with latest php-5.2 snapshot and FastCGI SAPI).
 [2006-10-31 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-08-31 15:51 UTC] arturm at union dot com dot pl
Bug is still there: PHP 5.2.10, XP Pro, IIS, CGI - C# client (timeout on req.GetResponse(), content type is application/x-www-form-urlencoded).
 [2009-08-31 16:41 UTC] pajoye@php.net
An example to reproduce the issue was asked. Saying that the bug is still here does not help.
 [2009-09-01 12:18 UTC] arturm at union dot com dot pl
I am trying to isolate bug. For this moment I noticed that content-type header plays important role. Only problem is with application/x-www-form-urlencoded. When request is text/xml it is OK.
 [2009-09-01 12:57 UTC] arturm at union dot com dot pl
OK, my test is similar (hangs on submit):

<?php

if($_SERVER["REQUEST_METHOD"] == "POST")
{
header("Content-type: text/xml");
$s = file_get_contents("php://input");
echo <<<EOT
<xml/>
EOT;
}
else
{
	echo <<<EOT
<form method="post" action="">
	<input type="text" value="abc">
	<input type="submit" name="s1" value="Submit">
</form>
EOT;
}
?>

Bug occured on:
1. Windows XP, PHP 5.2.10, IIS 5.1, CGI
2. Windows 2003, PHP 5.2.6, IIS 5.1, CGI
Didn't occured on:
Windows 2008, PHP 5.2.5 (x64), IIS 6, ISAPI
 [2009-09-01 13:03 UTC] pajoye@php.net
Please try with IIS6 or 7 with fcgi.
 [2009-09-02 09:00 UTC] arturm at union dot com dot pl
Thank you. There is simple way to make workaround. I just reported a bug :-)
 [2009-09-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 13:01:30 2024 UTC