#45922 [Fbk->Opn]: data is not transmmited throught pipes created by proc_open
ID: 45922
User updated by: TorokAlpar at Gmail dot com
Reported By: TorokAlpar at Gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Streams related
Operating System: Windows Xp
PHP Version: 5.2.6
New Comment:
I have tried with the latest snapshot, the result is the same
Previous Comments:
------------------------------------------------------------------------
[2008-08-26 22:13:07] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2008-08-26 14:31:43] TorokAlpar at Gmail dot com
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 this bug report at http://bugs.php.net/?id=45922&edit=1
Thread (5 messages)