php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kjarli at gmail dot com
New email:
PHP Version: OS:

 

 [2008-06-28 22:31 UTC] kjarli at gmail dot com
Description:
------------
Using some custom include paths does probably not effect file_exists

Reproduce code:
---------------
<?php
// 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 .
                 get_include_path());

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.

Patches

Pull Requests

History

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] jani@php.net
No it doesn't.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 05:01:27 2024 UTC