Bug #81179 [Opn->Ver]: fileperms() return wrong access information
Edit report at https://bugs.php.net/bug.php?id=81179&edit=1
ID: 81179
Updated by: cmb@php.net
Reported by: jhr at informedwebmaster dot com
Summary: fileperms() return wrong access information
-Status: Open
+Status: Verified
Type: Bug
Package: *Directory/Filesystem functions
Operating System: Windows Server 2019 Ver.: 1809
PHP Version: 8.0.7
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2021-06-20 04:20:15] jhr at informedwebmaster dot com
Description:
------------
This bug can be reproduced by creating a directory called test in the root of drive C:, add an text
file in the directory named "test.txt", give the IUSR user read but not write access to
the file. IUSR is the user account php uses on IIS 10 when running php-scripts. Then runthe
following php-code:
echo substr(sprintf('%o', fileperms('C:\test\test.txt')), -4);
It will show "0666" even thou the current user does not have write permission to the file.
If it's helpful, is_writable('C:\test\test.txt') does correctly return false.
Test script:
---------------
I did not write this code, i found it on php.net. But it works fine to reproduce the bug(please read
description):
echo substr(sprintf('%o', fileperms('C:\test\test.txt')), -4);
Expected result:
----------------
I expected to see "0644".
Actual result:
--------------
Actual result was "0666".
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81179&edit=1
Thread (2 messages)