From:             kyle at videoegg dot com
Operating system: Windows XP SP2
PHP version:      5.2.1RC2
PHP Bug Type:     Program Execution
Bug description:  proc_get_status - wrong PID

Description:
------------
This is identical to Bug #38542

There still seems to be an issue with this. I have upgraded my PHP
installation to "PHP 5.2.1RC3-dev (cli) (built: Jan  9 2007 00:24:29)" on
Windows and I am getting the wrong PID returned. 

proc_get_status returns 2976 for the PID while the script that is being
executed sees its PID as 3768 from getmypid(). 

Additionally, "tasklist" from the command line returns:

php.exe        3768 Console    0  9,084 K

Reproduce code:
---------------
pid.php
<?php
$descriptorspec = array(
        0 => array("pipe", "r"),  // stdin is a pipe that the child will read
from
        1 => array("pipe", "w"),  // stdout is a pipe that the child will write
to
        2 => array("pipe", "w")   // stderr is a pipe that the child will write
to
);

$resource = proc_open('php -f pid_output.php', $descriptorspec, $pipes);

$stats = proc_get_status($resource);

$handle = fopen("pid.dat", "a");
fwrite($handle, "Parent: " . $stats['pid'] . "\n");
fclose($handle);
?>

pid_output.php
<?php
$handle = fopen("pid.dat", "a");
fwrite($handle, "Child: " . getmypid() . "\n");
fclose($handle);
?>

Expected result:
----------------
Parent: 3480
Child: 3480


Actual result:
--------------
Parent: 3224
Child: 3480


-- 
Edit bug report at http://bugs.php.net/?id=40070&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40070&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40070&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40070&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40070&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40070&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40070&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40070&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40070&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40070&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40070&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40070&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40070&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40070&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40070&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40070&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40070&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40070&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40070&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40070&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40070&r=mysqlcfg

Reply via email to