|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45390 file_exists probably does not use custom include paths
Submitted: 2008-06-28 22:31 UTC Modified: 2008-07-01 09:43 UTC
From: kjarli at gmail dot com Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 5.2.6 OS: Windows xp sp3
Private report: No CVE-ID: None
 [2008-06-28 22:31 UTC] kjarli at gmail dot com
Using some custom include paths does probably not effect file_exists

Reproduce code:
// stripped down code of that what I'm using
// create a file: $rootPath/library/Berg/file.php you want to check

// this below is $rootPath/application/bootstrap.php
$rootPath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;

set_include_path($rootPath . 'library' . PATH_SEPARATOR .

var_dump(file_exists('Berg/file.php')) . '<br />';     // result false
var_dump(file_exists($rootPath . '/library/file.php')) // result true

require('Berg/file.php');                 // works
require($rootPath . '/library/file.php'); // works


Expected result:
I expect both var_dumps to return true

Actual result:
The one using the include path (or actually does not) gives false instead of true.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-28 22:35 UTC] kjarli at gmail dot com
I seem to have made a type error when submitting:
var_dump(file_exists($rootPath . '/library/file.php')) // result true

is supposed to be

var_dump(file_exists($rootPath . '/library/Berg/file.php')) // result true

Sorry for the confusing.
 [2008-06-29 02:22 UTC] crrodriguez at suse dot de
file_exists() does not use include_path, that's expected behaviuor.
 [2008-06-29 12:29 UTC] kjarli at gmail dot com
Well, maybe it becomes time that it does :)
 [2008-07-01 09:43 UTC]
No it doesn't.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 23:01:30 2024 UTC