From:             dk0110 at hotmail dot com
Operating system: RedHat Linux 7.3 & 8
PHP version:      4.3.1
PHP Bug Type:     Scripting Engine problem
Bug description:  Flex scanner failed input directory (readdir())

I created a function to get certain filenames (without extensions) from a
specified directory.  This function also will work to get all files.  The
problem occurs when the readdir() function executes.

ERROR: Fatal error: input in flex scanner failed in
/full/virtual/path/name/html/sub.domain.com/directory on line 1


Here is the function that I use:


function fnfile($dir, $search) {
 global $SCRIPT_FILENAME;
 $dir = dirname($SCRIPT_FILENAME)."/directory/".$dir."/";
 if (is_dir($dir)) {
  //it does pass this if statement
  $od = opendir($dir);
  $filelist = array();
  while (($file = readdir($od)) !== false) {
   /error occurs above when directory is read (maybe as a file?)
   if ($search == substr($file, 0, strpos($file, "."))) {
    $filelist = array_merge($filelist, array($dir."/".$file));
   }
   elseif (($search == "*") AND ($file !== ".") AND ($file !== "..")) {
    $filelist = array_merge($filelist, array($dir."/".$file));
   }
  }
  if (count($filelist) == 0) { return false; }
  elseif (count($filelist) >= 2) { return $filelist; }
  else { return implode("", $filelist); }
  closedir($od);
 }
}


This happened on two boxes that it was tried on, so it is recursive.  The
directory name was changed to see if the problem occured because of the
original (which was 00000), and the problem still occured.  These
directories included first letter and last letter strings, but the error
occured yet.

Thanks for your time, hope this can be fixed.
-- 
Edit bug report at http://bugs.php.net/?id=23880&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=23880&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=23880&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=23880&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=23880&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=23880&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=23880&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=23880&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=23880&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=23880&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=23880&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23880&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=23880&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=23880&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=23880&r=gnused

Reply via email to