ID:               47763
 Updated by:       [email protected]
 Reported By:      ies_clan at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Filesystem function related
 Operating System: Windows XP SP3
 PHP Version:      5.2.9
 New Comment:

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

That's the expected behavior because cmd.exe has been used to launch
notepad. To get the result you're expecting, use the bypass_shell option
of proc_open()'s 4th parameter (http://php.net/proc_open):

$process = proc_open($cmd, $descriptorspec, $pipes,
array('bypass_shell' => TRUE));


Previous Comments:
------------------------------------------------------------------------

[2009-03-24 15:44:01] ies_clan at hotmail dot com

Description:
------------
The function proc_get_status returns a wrong PID

Reproduce code:
---------------
<?php
$cmd = 'notepad';
$descriptorspec = array( 0 => array('pipe', 'r' ), 1 => array('pipe',
'w' ), 2 => array('pipe', 'w' ) );
$process = proc_open($cmd, $descriptorspec, $pipes);
$status = proc_get_status( $process );
echo 'PID = ', $status['pid'], "\n";
passthru( 'tasklist /fi "imagename eq notepad.exe"');
echo "\n\n";
passthru( 'tasklist /fi "pid eq ' . $status['pid'] . '"' );
echo "\n\n";
proc_terminate($process);
?>


Expected result:
----------------
PID = 2408

Abbildname                  PID Sitzungsname      Sitz.-Nr.
Speichernutzung
========================= ===== ================ ==========
===============
notepad.exe                2408 Console                   0        
2.560 K



Abbildname                  PID Sitzungsname      Sitz.-Nr.
Speichernutzung
========================= ===== ================ ==========
===============
cmd.exe                    2336 Console                   0        
2.560 K




Actual result:
--------------
PID = 2336

Abbildname                  PID Sitzungsname      Sitz.-Nr.
Speichernutzung
========================= ===== ================ ==========
===============
notepad.exe                2408 Console                   0        
2.560 K



Abbildname                  PID Sitzungsname      Sitz.-Nr.
Speichernutzung
========================= ===== ================ ==========
===============
cmd.exe                    2336 Console                   0        
2.560 K





------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47763&edit=1

Reply via email to