Here's the relevant code from the Zip.php PEAR class (sorry, this site is using Zip not Tar).
// ----- Read the directory for files and sub-directories
$p_hdir = opendir($p_filename);
$p_hitem = readdir($p_hdir); // '.' directory
$p_hitem = readdir($p_hdir); // '..' directory
while ($p_hitem = readdir($p_hdir)) {
...
Could there be a case where opendir() returns something other than . and .. as the first two entries?
I tried this, but I get an error (CGI application did not return a complete set of headers):
// ----- Read the directory for files and sub-directories
$p_hdir = opendir($p_filename);
//$p_hitem = readdir($p_hdir); // '.' directory
//$p_hitem = readdir($p_hdir); // '..' directory
while ($p_hitem = readdir($p_hdir)) {
if($p_hitem == '.' || $p_hitem == '..') continue;
...