ID:               15665
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: FreeBSD 4.4-STABLE
 PHP Version:      4.1.1
 New Comment:

Can you enable --with-debug please and post a backtrace?

Btw, how often have you to call readdir() until it crashes?

Btw, your code won't work for directories containing files or dirs
naming like '0'; see the manual page and use 'while (false !== ($s =
readdir() ...'

Also, can you try the source relese itself please and not a/the port?


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

[2002-02-21 17:24:16] [EMAIL PROTECTED]

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

Reply via email to