From: zambrow at hotmail dot com Operating system: Windows 2000 PHP version: 4.3.2 PHP Bug Type: Scripting Engine problem Bug description: proc_open Apache 1.3.27 with php 4.3.2
Apache 1.3.27 with php 4.3.2. I'm tryin to implement a way to do a 2-way communication through telnet for my script here's what I've found! (111.111.111.111 example ip is a unix box and it is accepting telnet connections" Consider this. $failed = false; // authentication failure flag $cmd="telnet 111.111.111.111"; $descriptorspec = 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 pipe that the child will write to ); $userID="user"; $password="password"; $process = proc_open("$cmd", $descriptorspec, $pipes); echo $process; if (is_resource($process)) { fwrite($pipes[0], "$userID\r"); fwrite($pipes[0], "$password\r"); fwrite($pipes[1], "exit\r"); while(!feof($pipes[1])) { $line = fgets($pipes[1], 1024); $loginFailed = strpos($line, "invalid login name or password"); if ($loginFailed != false) { $failed = true; // echo "FAILED LOGGING"; } // DEBUG OUTPUT echo $line; echo "---<br>"; } fclose($pipes[1]); $return_value = proc_close($process); echo "<br><b>command returned<b> $return_value\n"; } The following will result in empty pipes[1]. I'm unable to get anything out of that pipe as well the fgets just seems to hang. when i try the same code on AIX platform it works. So i'm thinking its a bug... -- Edit bug report at http://bugs.php.net/?id=24123&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24123&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24123&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24123&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24123&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24123&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24123&r=support Expected behavior: http://bugs.php.net/fix.php?id=24123&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24123&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24123&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24123&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24123&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24123&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24123&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24123&r=gnused