|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2017-04-11 13:51 UTC] cmb@php.net
 
-Type: Bug
+Type: Documentation Problem
  [2017-04-11 13:51 UTC] cmb@php.net
  [2017-04-11 14:02 UTC] miklcct at gmail dot com
  [2017-05-02 17:44 UTC] ab@php.net
 
-Status: Open
+Status: Feedback
  [2017-05-02 17:44 UTC] ab@php.net
  [2017-05-08 04:14 UTC] miklcct at gmail dot com
 
-Status: Feedback
+Status: Open
  [2017-05-08 04:14 UTC] miklcct at gmail dot com
  [2021-10-04 15:26 UTC] cmb@php.net
 
-Status:      Open
+Status:      Duplicate
-Assigned To:
+Assigned To: cmb
  [2021-10-04 15:26 UTC] cmb@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 13:00:01 2025 UTC | 
Description: ------------ On Windows, SplFileInfo::getRealPath() returns false if the containing folder is not readable even if the file itself is readable. This breaks in typical usage scenario where a SplFileInfo object is constructed using an uploaded file in temporary folder on Windows because the temporary folder in Windows is not readable by default, but creating files are allowed inside. To reproduce, follow the below steps: 1. Make directory C:\dir 2. Make file C:\dir\file and put some text inside 3. Run the script, ensure that the second var_dump returns the path 4. Add an NTFS permission entry on C:\dir saying "deny everyone on this folder only advanced permission list folder / read data" 5. Run the script again Test script: --------------- <?php $path = 'C:\dir\file'; $file = new SplFileInfo($path); var_dump(file_get_contents($path)); var_dump($file); var_dump($file->getRealPath()); Expected result: ---------------- Output similar to the below on both runs: M:\splfileinfo_bug.php:4: string(5) "test " M:\splfileinfo_bug.php:5: class SplFileInfo#1 (2) { private $pathName => string(11) "C:\dir\file" private $fileName => string(4) "file" } M:\splfileinfo_bug.php:6: string(11) "C:\dir\file" Actual result: -------------- After denying permission, the script outputs: M:\splfileinfo_bug.php:4: string(5) "test " M:\splfileinfo_bug.php:5: class SplFileInfo#1 (2) { private $pathName => string(11) "C:\dir\file" private $fileName => string(4) "file" } M:\splfileinfo_bug.php:6: bool(false) Note that the file is readable but SplFileInfo::getRealPath() returns false.