ID:               20186
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Reproducible crash
 Operating System: FreeBSD
 PHP Version:      4.2.2
 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.




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

[2002-10-31 09:05:14] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Please try it with CVS version.

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

[2002-10-31 03:57:49] [EMAIL PROTECTED]

Sorry, might help to mention that I did try the function first without
using globals and returning the directory file_count and adding it up
and returning the total, also had the same problem.

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

[2002-10-31 03:50:10] [EMAIL PROTECTED]

I get this all the time when I include a recursive function call. I've
tried rewriting the function several ways and get intermitten
Segmentation faults, saw a SuSe Linux report about scripts terminating
with similar output in the web server error_log.

I"ve tried just opening the fh and going down recursive directories
with this, got the seg faults often.This version
buffers the file names in an array, closes the directory handle then
processes the array, to count certain types of files in the directory
tree. Still segfaults often enough to make it unreliable. I turned on
the autoflush in php.ini and it dies in this routine.

FreeBSD 4.5-RELEASE
Apache/1.3.26 (Unix) PHP/4.2.2 mod_ssl/2.8.9 OpenSSL/0.9.6g
RegisterGlobals = On  :)

I use a perl script for my apache coplilation, here's my php_config
line.

--with-mysql=/usr/local --with-gd=/usr/local
--with-jpeg-dir=/usr/local/lib  --with-png-dir=/usr/
local/lib --with-zlib-dir=/usr/lib $xpm
--with-freetype-dir=/usr/local/lib --with-mcrypt=/usr/local
--with-gettext --wit
h-xml --with-zlib=/usr --with-bz2=/usr/local  --with-zip=/usr/local
--with-mm=/usr/local --with-apache=../$apache --enable-ftp
--disable-debug --enable-track-vars

Here's the current version of the function

function CountFiles($dir,$d) {
  global $home;
  global $prod_count;
  $farray = array(); $d++;
  if (is_dir("$home$dir")) {
    print "<!-- ISDIR dir=$dir level=$d -->\n";
    if ($dfh = @opendir("$home$dir")) {
        while (($fil = readdir($dfh)) !== false) {
                if (!preg_match("/^\.+$/", $fil)) {
                        array_push($farray,"$fil");
                }
        }
        closedir($dfh);
        if (count($farray) > 0) {
          while (list ($key, $file) = each ($farray)) { 
            if (is_dir("$home$dir/$file")) {
                CountFiles("$dir/$file",$d);
                flush();
            } else if (preg_match("/^thumb_\w+\.|\.wav$|\.aif$/", $file)) {
                $prod_count++;
                print "<!-- POST dir=$dir/$file prod_count=$prod_count -->\n";
                flush();
            }
        }
      }
    }
  }
  flush();
}

It's not entirely reproducible, but once I got a directory where it
causes the segfault I can comment out this routine and it's okay,
comment it back and reload and it segfaults.
So in that sense it's reproducible. Restarting the web server has no
effect. Though if I reload enough times sometimes the script completes,
there is definitely some sort of bug, maybe the filehandle or array
declaration isn't local or leaks out, not sure.

Hope it's not something stupid I overlooked. :)

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


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

Reply via email to