[PHP-DEV] Bug #1349: readdir and $d->read return blank filenames From: p_ross <email protected>
Date: 04/26/99

From: p_ross <email protected>
Operating system: IRIX 6.2
PHP version: 3.0.7
PHP Bug Type: Misbehaving function
Bug description: readdir and $d-&gt;read return blank filenames

The following script

<?php
$fileno = $column = 0;
$TDopen = array ( 0 => "\n<TR><TD>\n", 1 => "\n</TD><TD>\n", 2 => "\n</TD><TD>\n
");

$Book_Of_Spells = "/usr/localhost/apache/share/htdocs/admin/pages/book_of_spells
";

$B_O_S = dir ( "$Book_Of_Spells/RCS" );
echo "Handle: ".$B_O_S->handle."<br>\n";
echo "Path: ".$B_O_S->path."<br>\n";
while ($filesname = $B_O_S->read())
{
   if (ereg ( "html", $filename ))
   {
      $name = split (",", $filename);
      $title = passthru (`rlog -t $Book_Of_Spells/$name[0] | grep -v \":\" | gre
p -v \"^=====\" | grep -v \"^\$\"`);
      print $TDopen[$column++];
      print "<FONT SIZE=-2><A HREF=\"$Book_Of_Spells/$name[0]\">$title</A></FONT
>";
   }
   else
   {
      print $TDopen[$column++];
      print "File No. ".++$fileno.":".$filename;
   }
   if ($column == 3)
   {
      $column = 0;
      print "\n</TD></TR>";
   }
}
if ($column != 0)
{
   for ($i=$column; $i<3; $i++)
   {
      print "$TDopen[$i]";
      print "&nbsp;";
   }
   print "\n</TD></TR>";
}
$B_O_S->close();
?>

spits out the correct pathname and the correct _number_ of filenames, but they are all blank. I have no doubt that I am doing something wrong, but I can't find it. I followed the opendir/rewinddir/readdir examples first but couldn't tell what was really going on. When I switched over to the class examples I finally got the pathname and found that it was correct. This was a perl script and I'm trying to convert it over to php3. Haven't even gotten to debugging the passthru. One thing at a time.

I neither compiled nor installed php3, but, if you could tell me what you need, I'll be glad to provide it (the httpd.conf and php3.ini files are a bit big for attaching if you don't need the whole thing).

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>