PHP 4.3.10_2 readdir() misses files

Joerg Anslik joerg at anslik.de
Mon Feb 7 11:27:18 PST 2005


Okay,

>Any chance to run the CLI in GDB (or at least ktrace)?

Just to be sure, I completely wiped /usr/obj and did a full
buildworld/buildkernel 10 minutes ago. I created a test directory
/tmp/phptest, containing 10 copies of /etc/hosts, all having same
permissions, etc.

/bin/ls gives, as expected,
=================================
uberrechner:/tmp/phptest# ls
1       10      2       3       4       5       6       7       8
9
uberrechner:/tmp/phptest#
=================================



Running the PHP test program on the test dir gives:
=================================
uberrechner:/tmp/phptest# php /W/test.phtml
[..]
[2]
[4]
[6]
[8]
[10]
uberrechner:/tmp/phptest#
=================================



Clear to see, files named ".", "1", "3", "5", "7", and "9" are
missing. Also clear to see: it's every second file that's been
missing, starting by index 0. To proove this, I added 10 more copies
and get:
=================================
uberrechner:/tmp/phptest# php /W/test.phtml
[..]
[2]
[4]
[6]
[8]
[10]
[12]
[14]
[16]
[18]
[20]
uberrechner:/tmp/phptest#
=================================


The corresponding PHP program producing this was mentioned earlier;
however, here it is again:

----------
<?php
if(($dh = @opendir("/tmp/phptest")) == false) {

	print "No such dir!\n";
	
	exit;
}

while($entry = readdir($dh)) {

	print "[$entry]\n";
}

closedir($dh);
?>
----------

Nothing strange about this, so far. I made a ktrace, which can be
found here:

http://www.bettlakenauszuzeln.magic-ceee.com/phptest_ktrace.out


I'd really like to know if anyone else can reproduce this kinda Obi
Wan error...

--j

------------------
cd /pub
more beer





More information about the Users mailing list