ID: 15665 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Reproducible crash Operating System: FreeBSD 4.4-STABLE PHP Version: 4.1.1 New Comment:
forgon to tell you... apache 1.3.22 and php4.1.1 (both from the ports collection) Previous Comments: ------------------------------------------------------------------------ [2002-04-13 08:54:30] [EMAIL PROTECTED] I have the same problems with a script under freebsd4.5-release. It just started crasching out of nothing. No change in the dirscancode, no change on the server. Worked just fine before yesterday. The only way to run the script now is to press the updatebutton in internetexplorer several times quite quickly, it works when I do so (I get about 5-6 httpds wotrking in the background). This is so strange. ------------------------------------------------------------------------ [2002-02-22 03:47:22] [EMAIL PROTECTED] The option is --enable-debug, right? --with-debug appeared to do nothing. When compiled with --enable-debug, the script did not crash. But it certainly crashes with a normal build without debugging. ------------------------------------------------------------------------ [2002-02-21 19:30:43] [EMAIL PROTECTED] I'll compile PHP from source with debugging and test tomorrow. Can't do it today since I just changed the code to exec find, and it already processed today's files (is a webserver log processing helper script). You're right, I know about the 0/false issue, but I was lazy since all the filenames will always be fully qualified hostnames :) I don't remember exactly how many times readdir() was being called before it crashed, but probably somewhere between 100-200. When it first crashed, I noticed I had been calling that function a lot without using closedir(), but after I added it and only called it once on a single directory, it still crashed. ------------------------------------------------------------------------ [2002-02-21 18:50:04] [EMAIL PROTECTED] 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? ------------------------------------------------------------------------ [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