From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.4-STABLE
PHP version:      4.1.1
PHP Bug Type:     Reproducible crash
Bug description:  readdir() crashes

readdir() is consistently crashing PHP in one of my scripts. 
Unfortunately, I can't reproduce the problem with a small test script, for
some reason.  However, the function that is causing PHP to scrash is shown
below.  It is crashing after a number of readdir() calls:

    function list_dir($name)
    {
        $d = opendir($name);
        while ($s = readdir($d))
            if (($s != ".") && ($s != ".."))
                $a[] = $s;
        closedir($d);
        return isset($a) ? $a : false;
    }

This is the CGI version, running from the command line.  A backtrace is
shown below:

(gdb) bt
#0  0x286ed20d in readdir_r () from /usr/lib/libc.so.4
#1  0x80dbd9b in php_if_readdir ()
#2  0x8146e04 in execute ()
#3  0x8146ffd in execute ()
#4  0x8146ffd in execute ()
#5  0x8146ffd in execute ()
#6  0x8129418 in zend_execute_scripts ()
#7  0x806e6be in php_execute_script ()
#8  0x806c8d0 in main ()
#9  0x806bcd3 in _start ()

I can provide more information if necessary.  PHP was compiled from ports
within the last week.

-- 
Edit bug report at http://bugs.php.net/?id=15665&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15665&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15665&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15665&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15665&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15665&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15665&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15665&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15665&r=submittedtwice

Reply via email to