ID: 44987
Updated by: [EMAIL PROTECTED]
Reported By: ionut dot stan at yahoo dot com
-Status: Open
+Status: Assigned
Bug Type: SPL related
Operating System: Windows XP, Ubuntu 8.04
PHP Version: 5.2.6
-Assigned To: mboerger
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2008-05-13 22:52:26] ionut dot stan at yahoo dot com
Description:
------------
If SplFileObject is instantiated with the third parameter (search
include_path) set to true:
$file = new SplFileObject($filename, 'r', true);
and the file is indeed on path and found,
a consequent call to $file->getRealPath() returns false,
as if the file hasn't been found at all, instead of returning the real
path.
Reproduce code:
---------------
/wwwroot
|
|-> /directory
| |
| |-> testfile.txt
|
|-> test.php
In test.php:
<?php
set_include_path(dirname(__FILE__) . '/directory');
try {
$file = new SplFileObject('testfile.txt', 'r', true);
var_dump($file->getRealPath());
} catch (RuntimeException $e) {
echo 'File does not exist';
}
try {
$file = new SplFileObject('./directory/test-file.txt', 'r', true);
var_dump($file->getRealPath());
} catch (RuntimeException $e) {
echo 'File does not exist';
}
Expected result:
----------------
/wwwroot/directory/testfile.txt
/wwwroot/directory/testfile.txt
Actual result:
--------------
false
/wwwroot/directory/testfile.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44987&edit=1