php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65482 fileperms function reports wrong permissions on a file with ACL
Submitted: 2013-08-20 03:25 UTC Modified: 2021-10-04 15:32 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lukl at eabrno dot cz Assigned:
Status: Verified Package: Filesystem function related
PHP Version: 5.4.18 OS: Linux CentOS 6.4
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lukl at eabrno dot cz
New email:
PHP Version: OS:

 

 [2013-08-20 03:25 UTC] lukl at eabrno dot cz
Description:
------------
Executing a code bellow for a file/directory with extended permissions (ACL) 
return wrong results.
E.g. a file with these ACLs (display permissions using OS getfacl command):

# file: file
# owner: user
# group: apache
user::rwx
group::r-x
group:webmasters:rwx
group:users:rwx
mask::rwx
other::---

The PHP code however returns 0757, which is weird (other has no permissions at 
all, but according fileperms it has rwx).

When I clear any extended permissions, the PHP code returns expected result of 
0750.

Test script:
---------------
<?php

echo substr(decoct( fileperms("file") ) , 2);

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-10-04 15:32 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2021-10-04 15:32 UTC] cmb@php.net
Confirmed.  This is because fileperms() basically does a stat()
call, which doesn't actually check the ACLs.  This needs to be
documented.  See also bug #43817.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 10:01:32 2024 UTC