#33296 [NEW]: popen (passthru etc.) doesn't work correct
| From: | thomas dot wetzler at siemens dot com | Date: | Fri, 10 Jun 2005 08:54:46 +0000 |
| Subject: | #33296 [NEW]: popen (passthru etc.) doesn't work correct | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-80121@lists.php.net to get a copy of this message | ||
From: thomas dot wetzler at siemens dot com
Operating system: SUN OS
PHP version: 4.3.10
PHP Bug Type: Program Execution
Bug description: popen (passthru etc.) doesn't work correct
Description:
------------
While sequentially opening and closing several processes via popen (or
passthru, exec and '' command) php looses some processes. This takes place
if, for instance, the user presses the reload-button on a website several
times.
With the coding below, you can reproduce the failure (takes place on
commandline (php.exe) and in apache module (mod_php)).
Reproduce code:
---------------
#!/wir/webadmin/share/php4/bin/php
#
<?
for ($i=0; $i<900; $i++) {
$statement = "ls -l";
echo "\n\n$i***************************\n";
$handle = popen($statement, 'r');
echo "Subprozess: '$handle'; " . gettype($handle) . "\n";
while (!feof($handle))
{
echo fread($handle, 8192);
}
pclose($handle);
}
?>
programcall: <progname> > <resultfile>
Expected result:
----------------
Within the result-file, there should be 900 times the same result from the
system command (here ls -l command).
255***************************
Subprozess: 'Resource id #259'; resource
total 2526
-rw-r--r-- 1 webadmin oracle 572135 Jun 10 09:52 _test1.txt
drwxr-xr-x 2 wir oracle 96 May 2 15:27 mail
-rw-r--r-- 1 wir oracle 258956 Jun 10 10:42 test
-rwxrwx--- 1 wir oracle 698 Jun 10 10:41 test.php
-rw-r--r-- 1 webadmin oracle 105326 Jun 10 09:52 test1
-rwxrwx--- 1 wir oracle 656 Jun 10 09:48 test1.php
-rwxr-x--- 1 wir oracle 321 Jun 10 10:43 thomas.php
-rw-r--r-- 1 wir oracle 148274 Jun 10 10:43 thw.txt
Actual result:
--------------
Some results are missing. The same programm written in perl or shellscript
is working correct.
-rwxr-x--- 1 wir oracle 321 Jun 10 10:43 thomas.php
-rw-r--r-- 1 wir oracle 148274 Jun 10 10:43 thw.txt
256***************************
Subprozess: 'Resource id #260'; resource
257***************************
Subprozess: 'Resource id #261'; resource
total 2526
-rw-r--r-- 1 webadmin oracle 572135 Jun 10 09:52 _test1.txt
drwxr-xr-x 2 wir oracle 96 May
--
Edit bug report at http://bugs.php.net/?id=33296&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33296&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33296&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33296&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33296&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33296&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33296&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33296&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33296&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33296&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33296&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33296&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33296&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33296&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33296&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33296&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33296&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33296&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33296&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33296&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33296&r=mysqlcfg