php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66439 Read from php://input on PUT request hanging
Submitted: 2014-01-08 13:10 UTC Modified: -
From: r dot westende at gmail dot com Assigned:
Status: Open Package: IIS related
PHP Version: 5.4.23 OS: Windows Server 2008 R2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: r dot westende at gmail dot com
New email:
PHP Version: OS:

 

 [2014-01-08 13:10 UTC] r dot westende at gmail dot com
Description:
------------
When reading an HTTP PUT request's body from php://input PHP hangs.

The Windows Server 2008 R2 runs PHP 5.4.23 on IIS 7.5 using the FastCgiModule.

Test script:
---------------
Dump the following PHP code in a file on a server.

<?php
	// Allow from any origin
    if (isset($_SERVER['HTTP_ORIGIN'])) {
        header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
        header('Access-Control-Allow-Credentials: true');
        header('Access-Control-Max-Age: 86400');    // cache for 1 day
    }

    // Access-Control headers are received during OPTIONS requests
    if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {

        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
            header("Access-Control-Allow-Methods: PUT, GET, POST, OPTIONS");         

        if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
            header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");

        exit(0);
    }

   $inpData = file_get_contents('php://input');
   
   echo($inpData);
   
   echo("Done");
?>

Then test using this JSFiddle and change the location of the PHP file it PUTS vs POSTS to.

http://jsfiddle.net/piepkrak/bGGL2/

Expected result:
----------------
When running the test above, the result of a POST request will be "testDone" without quotes. The result of a PUT request should be the same.

Actual result:
--------------
A POST request results in the expected behavior. A PUT request should be the same, but times out. It will display "timeout" without quotes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Oct 24 05:01:28 2019 UTC