Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.1

Request #7559 fileExists method
Submitted: 2006-05-04 18:24 UTC
From: denny at php dot net Assigned: mike
Status: Closed Package: File (version 1.2.2)
PHP Version: Irrelevant OS: All
Roadmaps: 1.3.0a1    
Subscription  


 [2006-05-04 18:24 UTC] denny at php dot net (Denny Shimkoski)
Description: ------------ The following method checks for a file's existence, taking the current include path into consideration. Test script: --------------- /** * Checks for a file's existence, taking the current include path into consideration * * This method can be called statically (e.g., File_Util::fileExists('config.php')) * * @param string $filename * @param string $slash the directory separator (optional) * @return false|string * @access public * @static */ function fileExists($filename, $slash = DIRECTORY_SEPARATOR) { $includePath = ini_get('include_path'); if ($paths = explode(PATH_SEPARATOR, $includePath)) { foreach ($paths as $path) { $file = "$path$slash$filename"; if (file_exists($file)) { return $file; } } } return false; }

Comments

 [2007-02-20 10:06 UTC] mike (Michael Wallner)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.