PHP readdir is not reading some files
<p>I'm using the following code to loop through a directory to print out the names of the files. However, not all of the files are displayed. I have tried using <strong>clearstatcache</strong> with no effect.</p>

<pre><code> $str = '';
 $ignore = array('.', '..');

 $dh = @opendir( $path );
 if ($dh === FALSE)
 {
  // error
 }

 $file = readdir( $dh );
 while( $file !== FALSE )
 {
  if (in_array($file, $ignore, TRUE)) { break; }
  $str .= $file."\n";
  $file = readdir( $dh );
 }
</code></pre>

<p>Here's the contents of the directory right now:</p>

<pre><code>root.auth  test1.auth  test2.auth  test3.auth  test5.auth
</code></pre>

<p>However, test5.auth does not appear. If I rename it to test4.auth it does not appear. If I rename it to test6.auth it <strong>does</strong> appear. This is reliable behaviour - I can rename it several times and it still won't show up unless I rename it to test6.auth.</p>

<p>What on earth could be happening?</p>

<p>I'm running Arch Linux (kernel 2.6.26-ARCH) with PHP Version 5.2.6 and Apache/2.2.9 with Suhosin-Patch. My filesystem is ext3 and I'm running fam 2.6.10.</p>
