title: is_dir() fails while scanning a directory in php
body: <p>I'm trying to build a <code>&lt;ul&gt;</code> list with a <code>&lt;li&gt;</code> for each directory in a main folder.
  here's my code :</p>
  
  <pre><code>&lt;?php
  
  $dir = opendir(getEnv("DOCUMENT_ROOT") . "/folder");
  
  while(($file = readdir($dir)) !== false ){
    if( is_dir($file) &amp;&amp; $file !== "." &amp;&amp; $file !== ".." ){
      echo "&lt;li&gt;" . $file . "&lt;/li&gt;";
    }
  }
  
  closedir($dir);
  
  ?&gt;
  </code></pre>
  
  <p>there are two directories in /home/example/folder but there are not recognized as folders (for sure they are !)</p>
  
  <p>if I "<code>echo</code>" the files in the while loop they are printed (they well exist for the script no trouble on that side).
  If I try to "<code>filetype</code>" them, a <code>lstat failed</code> error is thrown, I searched on internet the meaning of it and I end up with nothing but technically support that I pain to understand.</p>