ID: 41874 Comment by: alexey dot kupershtokh at gmail dot com Reported By: ckeefer at us dot nomura dot com Status: Open Bug Type: Program Execution Operating System: Windows XP Pro SP2 PHP Version: 5.2CVS-2007-07-03 New Comment:
Hello guys. All the symfony community seems suffer from this bug. I'm not sure whether this is exactly the same problem comparing to the bugstarter's, but symptoms are very similar. The following ssh.exe is taken from a cwRsync package. Sorry for using this exe, I just don't know any other that requires user input. Description: ------------ PHP >=5.2.2 doesn't allow interaction with user for program executed by passthru/system/exec, where <=5.2.1 do. Reproduce code: --------------- php.exe -n -r "exec('ssh.exe dev.sibers.com');" Expected result: ---------------- PHP 5.2.1: C:\Distrib\Development\PHP\PHP Switcher\5.2.1\php>php.exe -n -r "exec('ssh.exe dev.sibers.com');" The authenticity of host 'dev.sibers.com (89.251.97.196)' can't be established. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX. Are you sure you want to continue connecting (yes/no)? PHP 5.2.2: C:\Distrib\Development\PHP\PHP Switcher\5.2.2\php>php.exe -n -r "exec('ssh.exe dev.sibers.com');" The authenticity of host 'dev.sibers.com (89.251.97.196)' can't be established. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX. Are you sure you want to continue connecting (yes/no)? Actual result: -------------- For 5.2.1 is the same: C:\Distrib\Development\PHP\PHP Switcher\5.2.1\php>php.exe -n -r "exec('ssh.exe dev.sibers.com');" The authenticity of host 'dev.sibers.com (89.251.97.196)' can't be established. RSA key fingerprint is XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX. Are you sure you want to continue connecting (yes/no)? 5.2.2: C:\Distrib\Development\PHP\PHP Switcher\5.2.2\php>php.exe -n -r "exec('ssh.exe dev.sibers.com');" and it hangs w/o any output... Typing 'yes' blindly doesn't help ("C:\Documents and Settings\wicked\.ssh\known_hosts" stays unmodified). Previous Comments: ------------------------------------------------------------------------ [2007-07-19 20:00:23] [EMAIL PROTECTED] As I'm not any win32 expert (nor really care about it) I'll deassign this and forget that change, perhaps someone else who know the win32 stuff picks this up. ------------------------------------------------------------------------ [2007-07-18 15:47:23] ckeefer at us dot nomura dot com I don't actually see how this is an improvement as output was only mixed if you don't redirect, which is expected. If I do something like php progname.php > logfile.txt, I would previously redirect STDIN to the logfile as expected and stderr would still come to the console so I could monitor the program's progress. This is the usual behavior in shell programs, etc. This is how cmd line php was working through version 5.21. 5.22 on changed behavior in that from Win32, the STDERR disappears completely. If you can tell me where STDERR went and how to get to it from exec, I will happily do that. I have hundreds (if not thousands) of php scripts that do this. This new behavior breaks all of them. If I do php progname.php 2>&1 > logfile.txt, even if this works, I get mixed STDIN and STDERR output in the logfile.txt. This will force me to either stay at version 5.21 or earlier, or revise every script we have that currently uses the exec function. Again I ask: Did anything change with the compiler or other development tools used to create the Window Binary? Microsoft has been known to modify libraries in undocumented ways. Thanks Chip Keefer ------------------------------------------------------------------------ [2007-07-18 14:55:27] [EMAIL PROTECTED] Since this is actually improvement from previous behaviour where the output was mixed, I'm changing this to a FR. I'll look into adding an extra parameter to store STDERR in. In the meantime I suggest you use proc_open() or popen() which give you more control over these.. ------------------------------------------------------------------------ [2007-07-18 13:01:40] ckeefer at us dot nomura dot com >Oddly, 5.2.2+ versions still work correctly with cygwin/bash 3.1 Using the same Win32 binary, not a Cygwin binary. To [EMAIL PROTECTED]: That is a good suggestion for just getting STDERR output and I use it often on Unix and Linux systems when I need, and don't care if outputs are mixed. I haven't tested if this construct works with W32. Unfortunately, I need STDIN and STDERR separate. I also have a question: Did the version of compiler or libraries used to compile the binary change? MS is notorious for making undocumented changes to their development tools. Thanks, Chip Keefer ------------------------------------------------------------------------ [2007-07-18 08:45:45] [EMAIL PROTECTED] This works fine with *nix (found from the user comments at http://www.php.net/manual/en/function.exec.php : <?php $com= "ls foo"; exec("$com 2>&1", $out, $err); var_dump($out); ?> I don't know if Windows supports something like this, but iirc, it should. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41874 -- Edit this bug report at http://bugs.php.net/?id=41874&edit=1