php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45376 popen causes HTTP Error 502.2
Submitted: 2008-06-27 09:48 UTC Modified: 2008-07-17 01:14 UTC
From: louis at steelbytes dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.2.6 OS: Vista SP1 x64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: louis at steelbytes dot com
New email:
PHP Version: OS:

 

 [2008-06-27 09:48 UTC] louis at steelbytes dot com
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> ".

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-17 01:14 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC