|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-17 01:14 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 08:00:01 2025 UTC |
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> ".