ID:               33296
 Comment by:       screen at brainkrash dot com
 Reported By:      thomas dot wetzler at siemens dot com
 Status:           No Feedback
 Bug Type:         Program Execution
 Operating System: SUN OS
 PHP Version:      4.3.10
 New Comment:

Tested script from <thomas dot wetzler at siemens dot com> on php4.4.0
cli/apache2 and php4-STABLE-200507190640 on Linux server and ALL
samples worked. 

Found this bug searching for a similar (maybe the same) issue related
to popen/freads calling SVN. I modified this test script and ran tests
using 4.4.0 and php4-STABLE-200507190640 with the following results:

script
------
#!/usr/local/apache2/php/bin/php
#
<?
for ($i=0; $i<10; $i++) {
        $statement = "/usr/local/subversion/bin/svn help";
        echo "\n\n$i***************************\n";
        $handle = popen($statement, 'r');
        echo "Subprozess: '$handle'; " . gettype($handle) . "\n";
        
        $output = '';
        while (!feof($handle)) {
                $output .= fgets($handle);
        }
        echo $output;
        
        pclose($handle);
}
?>


results
-------
/usr/local/apache2/php/bin/php -f test.php > test440_cli.txt

        > works

wget -O test440_apache2.txt
http://brainkrash.com/~screen/test/test.php

        > all 10 fail with no return from fgets
        
/usr/local/apache2/php/bin/php -f test.php >
test4-200507190640_cli.txt

        > works

wget -O test4-200507190640_apache2.txt
http://brainkrash.com/~screen/test/test.php

        > all 10 fail with no return from fgets


expected result
---------------
0***************************
Subprozess: 'Resource id #4'; resource
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.2.1.
Type 'svn help <subcommand>' for help on a specific subcommand.

Most subcommands take file and/or directory arguments, recursing
on the directories.  If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
   add
   blame (praise, annotate, ann)
... <TRUNCATED>


failure results
---------------
0***************************
Subprozess: 'Resource id #2'; resource


<EOF>


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

[2005-06-23 01:00:04] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

[2005-06-15 19:16:03] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Try also the latest PHP 4 snapshot.


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

[2005-06-15 15:54:16] thomas dot wetzler at siemens dot com

We tried out PHP Version 5. With the commandline (php.exe) it seems to
work but with the mod_php-module we get the same failure. 

Because the testing of our application take a long time, it would be
good if you can find a solution for Version 4.

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

[2005-06-11 15:18:48] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2005-06-10 10:54:44] thomas dot wetzler at siemens dot com

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 this bug report at http://bugs.php.net/?id=33296&edit=1

Reply via email to