Bug #72515 [Opn->Fbk]: Proc_open does not work with sockets

From: Date: Fri, 01 Jul 2016 15:53:06 +0000
Subject: Bug #72515 [Opn->Fbk]: Proc_open does not work with sockets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201968@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72515&edit=1 ID: 72515 Updated by: ab@php.net Reported by: Anatolii_Ivaniuk_CW at bmc dot com Summary: Proc_open does not work with sockets -Status: Open +Status: Feedback Type: Bug Package: Streams related Operating System: Windows PHP Version: 5.5.37 Block user comment: N Private report: N New Comment: Thanks for the report. I'm currently unable to reproduce the issue with the latest 7.0 tree. The code seems correct, but i guess you should use PHP_BINARY instead of php.exe hardcoded. Anyway, could you please give some further info on how to reproduce? Thanks. Previous Comments: ------------------------------------------------------------------------ [2016-06-29 10:15:47] Anatolii_Ivaniuk_CW at bmc dot com 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 this bug report at https://bugs.php.net/bug.php?id=72515&edit=1

« previous php.bugs (#201968) next »