php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66593 Built-in web server should handle php://input as client socket
Submitted: 2014-01-28 11:06 UTC Modified: 2014-05-17 23:58 UTC
From: chobieeee@php.net Assigned: ajf (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.5.8 OS: N/A
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: chobieeee@php.net
New email:
PHP Version: OS:

 

 [2014-01-28 11:06 UTC] chobieeee@php.net
Description:
------------
Currently, Built-in web server handle php://stdin as STDIN.

this behaviour may cause hang when reading raw POST data.
almost php web application uses file_get_contents("php://stdin") for reading raw data (like json).


Test script:
---------------
# client.php
<?php

$data = "Hello World";
$length = strlen($data);

file_get_contents("http://127.0.0.1:11111/", false, stream_context_create(array(
        "http" => array(
                "method" => "POST",
                "header" => "Content-type: application/octet-stream\r\nContent-Length: $length",
                "content" => $data,
        )
)));

# server.php (php -S 127.0.0.1:11111 server.php)
<?php
error_log(file_get_contents("php://stdin"));

Expected result:
----------------
# server.php
Hello World

Actual result:
--------------
// builtin web server waits console input.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-29 12:43 UTC] chobieeee@php.net
Sorry, I've just misunderstood as `php://input`. never mind this report.
 [2014-02-18 23:12 UTC] cmbecker69 at gmx dot de
> never mind this report.

It seems reasonable to close the ticket. :)
 [2014-05-17 23:58 UTC] ajf@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ajf
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC