Bug #72515 [NEW]: Proc_open does not work with sockets
| From: | Anatolii_Ivaniuk_CW at bmc dot com | Date: | Wed, 29 Jun 2016 10:15:52 +0000 |
| Subject: | Bug #72515 [NEW]: Proc_open does not work with sockets | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201902@lists.php.net to get a copy of this message | ||
From: Anatolii_Ivaniuk_CW at bmc dot com
Operating system: Windows
PHP version: 5.5.37
Package: Streams related
Bug Type: Bug
Bug description:Proc_open does not work with sockets
Description:
------------
Starting from version 5.5.18 proc_open with socket handles does not wait
for input. Everything work fine in 5.5.17 version of php. If I open up a
child process and pass in socket to handle new clients commands in
5.5.17 version script is waiting for input and prints it. But in 5.5.18
and up till 7.0.4 this approach does not work anymore for windows and
works fine on linux environments.
Test script:
---------------
proc.php
########################################
$errno = '';
$errstr = '';
$socket = stream_socket_server("tcp://0.0.0.0:$port",$errno,$errstr);
$client = @stream_socket_accept($socket,1);
$handles = array(
0 => $socket,
1 => $socket,
2 => STDERR,
);
$pipes = array();
$h = proc_open('php.exe file.php',$handles,$pipes);
file.php
#####################################
echo(">");
if (($cmd = fgets(STDIN,2048)) === false)
return;
$cmd = trim($cmd);
echo($cmd);
Expected result:
----------------
Child process can read and write to socket.
Actual result:
--------------
Child process terminates as $cmd = fgets(STDIN,2048) is always false.
--
Edit bug report at https://bugs.php.net/bug.php?id=72515&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72515&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72515&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72515&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72515&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72515&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72515&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72515&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72515&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72515&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72515&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72515&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72515&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72515&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72515&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72515&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72515&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72515&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72515&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72515&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72515&r=mysqlcfg