From: louis at steelbytes dot com Operating system: Vista SP1 x64 PHP version: 5.2.6 PHP Bug Type: CGI related Bug description: popen causes HTTP Error 502.2
Description: ------------ 1. proc_open('I_dont_exist.exe') returns true. I feel it shouldn't (I'm guessing this is because php launches cmd.exe and asks it to run I_dont_exist.exe) 2. popen('I_dont_exist.exe') returns true if I execute the script from the commandline using php.exe -n -f test.php (see above for what I would expect), but if I execute it via php-cgi.exe in IIS, I get HTTP Error 502.2 - Bad Gateway (see below). Reproduce code: --------------- $proc = @proc_open( 'c:\\I_dont_exist1.exe' ,array( 0=>array('file','nul','r'), 1=>array('file','nul','w'), 2=>array('file','nul','w') ) ,$pipes ); if ($proc===false) die('failed proc_open'); proc_close($proc); echo 'proc_open ok'."<br>\r\n"; $proc = @popen('c:\\I_dont_exist2.exe','r'); if ($proc===false) die('failed popen'); pclose($proc); echo 'popen ok'."<br>\r\n"; Expected result: ---------------- ideally both should fail, as the target .exe doesn't exist, but not cause the script to die Actual result: -------------- HTTP Error 502.2 - Bad Gateway The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "'c:\I_dont_exist2.exe' is not recognized as an internal or external command, operable program or batch file. X-Powered-By: PHP/5.2.6 Content-type: text/html start<br> proc_open ok<br> popen ok<br> end<br> ". -- Edit bug report at http://bugs.php.net/?id=45376&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45376&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45376&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45376&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45376&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45376&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45376&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45376&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45376&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45376&r=support Expected behavior: http://bugs.php.net/fix.php?id=45376&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45376&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45376&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45376&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45376&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45376&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45376&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45376&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45376&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45376&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45376&r=mysqlcfg