php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23880 Flex scanner failed input directory (readdir())
Submitted: 2003-05-29 19:02 UTC Modified: 2003-06-03 23:43 UTC
From: dk0110 at hotmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.2.2 & 4.3.1 OS: RedHat Linux 7.3 & 8
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
46 - 27 = ?
Subscribe to this entry?

 
 [2003-05-29 19:02 UTC] dk0110 at hotmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-29 19:10 UTC] dk0110 at hotmail dot com
The comment after the while statement should have two slashes, this occured due to me preparing the bug report too quickly.  Sorry about that.
 [2003-05-29 19:22 UTC] wez@php.net
Try 4.3.2 which was released today
 [2003-06-03 23:43 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC