|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-05-20 21:49 UTC] colder@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 10:00:02 2025 UTC |
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