|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-05-18 09:36 UTC] vinirresko at hotmail dot com
Description:
------------
I found an error on the file_exists() function.
When i try to teste, e.g.:
$dir = "/class/test.php"; // this directory really exists, approved.
When i try to test, returned a false value.
Test script:
---------------
<?
$dir = "/class/test.php"; // this directory really exists, approved.
if(file_exists($dir)){
print "File ".$dir." exists.";
}else{
print "File ".$dir." does not exists.";
}
?>
Expected result:
----------------
returns : File /class/test.php exists.
Actual result:
--------------
returns : File /class/test.php does not exists.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
Yes, it can be read, and if i test: require_once("/class/test.php"); it is accepted, so i think who the problem is on the file_exists() function.Right, i'll send the archive, ok ? <? $includes = array(); $includes[0] = '/class/conexao.class.php'; $includes[1] = '/class/query.class.php'; for($i = 0; $i < count($includes);$i++){ try{ if(file_exists($includes[$i])){ include_once($includes[$i]); }else{ throw new Exception("Arquivo ".$includes[$i]." não existe."); } }catch(Exception $e){ print "<script>alert('".$e->getMessage()."')</script>"; exit; } } ?>No, thanks. All I need is the info I asked here. The permission, are junctions part of the path, etc. A simple test case like var_dump("/foo/bar.php"); is enough.$test = var_dump("/class/autenticacao.class.php"); print $test; returned: string(29) "/class/autenticacao.class.php" have no junctions of the pach.$test = var_dump(file_exists("/class/autenticacao.class.php")); Returned: bool(false) $test = var_dump(file_exists("/class/autenticacao.class.php")); Returned: bool(true) I'm using Apache.$test = var_dump(file_exists("/class/autenticacao.class.php")); Returned: bool(false) $test = var_dump(file_exists("C:\Arquivos de programas\EasyPHP5.3.0\www\class\autenticacao.class.php")); Returned: bool(true) I'm using Apache. //Sorry, i forget to update pach..