#41052 [NEW]: proc_get_status still returns wrong PID (-> closed bug 38542)!

From: Date: Wed, 11 Apr 2007 12:40:02 +0000
Subject: #41052 [NEW]: proc_get_status still returns wrong PID (-> closed bug 38542)!
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111345@lists.php.net to get a copy of this message
From: patrick dot pomme at rtl dot de Operating system: Windows XP PHP version: 5.2.2RC1 PHP Bug Type: Program Execution Bug description: proc_get_status still returns wrong PID (-> closed bug 38542)! Description: ------------ Under Windows XP and server 2003, proc_get_status returns a wrong PID. While executing a system command I wanted to know its PID to be able to close it after a defined timeout Reproduce code: --------------- $cmd = "ping -t video-jobcoder"; $descriptorspec = array( 0 => array("file", "stdin.txt", "a"), // stdin is a pipe that the child will read from 1 => array("file", "stdout.txt", "a"), // stdout is a pipe that the child will write to 2 => array("file", "stderr.txt", "a") // stderr is a file to write to ); $process = proc_open($cmd, $descriptorspec, $pipes); $pinfo = proc_get_status($process); print_r($pinfo); $timeout = 5; while(@proc_get_status($process)){ echo "$timeout.."; sleep(1); $timeout--; if($timeout == 0) { echo "\r\nTimeout! Killing process with PID ".$pinfo[pid]."!"; exec($path_to_pskill."pskill -t ".$pinfo[pid]." 2>nul", $res_pskill); for ($i=count($res_pskill)-3; $i<count($res_pskill); $i++) echo $res_pskill[$i]."\r\n"; proc_terminate($process); } } Expected result: ---------------- $pinfo[pid] should contain the PID of the ping process proc_terminate should close it Actual result: -------------- $pinfo[pid] returns a wrong number -- Edit bug report at http://bugs.php.net/?id=41052&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41052&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41052&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41052&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41052&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41052&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41052&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41052&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41052&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41052&r=support Expected behavior: http://bugs.php.net/fix.php?id=41052&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41052&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41052&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41052&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41052&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41052&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41052&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41052&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41052&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41052&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41052&r=mysqlcfg

« previous php.bugs (#111345) next »