From: TorokAlpar at Gmail dot com Operating system: Windows Xp PHP version: 5.2.6 PHP Bug Type: Streams related Bug description: data is not transmmited throught pipes created by proc_open
Description: ------------ After starting a program (Written in C) with proc_open the pipes opened seem to be invalid. It looks like no data is transmitted over to the childs stdin, On a read the script blocks. Please bear with me, this is my firs bug report, and i am debugging this for 7 hours now. here are my modules: [PHP Modules] bcmath calendar com_dotnet ctype date dom domxml exif filter ftp gd gettext hash iconv imap json libxml mbstring mcrypt mime_magic ming mssql mysql mysqli odbc paradox pcre pdf PDO pdo_mssql pdo_mysql ps Reflection session SimpleXML soap sockets SPL SQLite standard tokenizer wddx xdebug xml xmlreader xmlrpc xmlwriter xsl zip zlib [Zend Modules] Xdebug Note tha i also tried without Xdebug Reproduce code: --------------- $aDescriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("pipe", "w") // stderr is a file to write to ); $aOptions = array('bypass_shell' => true); // doesn't influence the behavior $rProcess = proc_open('F:\\checkpe-debug2.exe validpe', $aDescriptorspec, $aPipes, null,null, $aOptions); // $aPipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout if (! is_resource($rProcess)) { // stream_set_write_buffer($aPipes[0], 0); // fputs($aPipes[0],$sPath."\n",strlen($sPath)+1); fwrite($aPipes[0],$sPath."\n"); // fflush($aPipes[0]); sleep(1); $sResponse = fread($aPipes[1],2); var_dump($sResponse); } /* NOTE : Commented lines don't influence the result if they are not commented The executable does work right, tested on the command line If you swap the executable with a php script that does the same thing (reads in file paths separated with \n and writes 2 character responses) everything functions as expected */ Expected result: ---------------- var_dump the 2 characters read from the output of the child Actual result: -------------- Script hangs , hang caused by the lien that reads: $sResponse = fread($aPipes[1],2); -- Edit bug report at http://bugs.php.net/?id=45922&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45922&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45922&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45922&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45922&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45922&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45922&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45922&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45922&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45922&r=support Expected behavior: http://bugs.php.net/fix.php?id=45922&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45922&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45922&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45922&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45922&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45922&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45922&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45922&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45922&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45922&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45922&r=mysqlcfg