Warning when using readdir() on certain versions of CentOS on NFS-mounted directories:
This is not a bug with PHP's readdir, but a bug with certain versions of CentOS's readdir implementation. According to Post #6213 in the CentOS Bugs forum, when using CentOS kernel versions 2.6.18-348 through 2.6.18-348.3.1, invoking readdir on an NFS-mounted directory may not return all the entries. Since PHP's readdir() uses this library, the issue is manifest in PHP as well.
According to the post, upgrading to version 2.6.18-348.4.1.el5 should solve the issue, though I haven't tried it.
glob() does NOT seem to suffer from this same vulnerability.