Req #66593 [NEW]: Built-in web server should handle php://input as client socket

From: Date: Tue, 28 Jan 2014 11:06:02 +0000
Subject: Req #66593 [NEW]: Built-in web server should handle php://input as client socket
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184049@lists.php.net to get a copy of this message
From:             chobieeee
Operating system: N/A
PHP version:      5.5.8
Package:          Built-in web server
Bug Type:         Feature/Change Request
Bug description:Built-in web server should handle php://input as client socket

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.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=66593&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66593&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66593&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66593&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66593&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66593&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66593&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66593&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66593&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66593&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66593&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66593&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66593&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66593&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66593&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66593&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66593&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66593&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66593&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66593&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66593&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#184049) next »