Re: Silenced include(_once) calls
| From: | bertrand Gugger | Date: | Wed, 08 Mar 2006 18:26:16 +0000 |
| Subject: | Re: Silenced include(_once) calls | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-41720@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Hi, I have made the relevant changes in MDB2 and LiveUser. Would be a nice static method in PEAR some day .. regards, Lukas for those not following cvs:
function fileExists($file)
{
- $dirs = explode(PATH_SEPARATOR, ini_get('include_path'));
- foreach ($dirs as $dir) {
- if (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
- return true;
- }
+ $fp = @fopen($file, 'r', true);
+ if (is_resource($fp)) {
+ @fclose($fp);
+ return true;
}
return false;
}