Bug->Doc #65482 [Opn->Ver]: fileperms function reports wrong permissions on a file with ACL

From: Date: Mon, 04 Oct 2021 15:32:50 +0000
Subject: Bug->Doc #65482 [Opn->Ver]: fileperms function reports wrong permissions on a file with ACL
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-19246@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65482&edit=1

 ID:                 65482
 Updated by:         cmb@php.net
 Reported by:        lukl at eabrno dot cz
 Summary:            fileperms function reports wrong permissions on a
                     file with ACL
-Status:             Open
+Status:             Verified
-Type:               Bug
+Type:               Documentation Problem
 Package:            Filesystem function related
 Operating System:   Linux CentOS 6.4
 PHP Version:        5.4.18
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2013-08-20 03:25:32] 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);

?>



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=65482&edit=1


Thread (1 message)

  • cmb@php.net
  • Unknown Message
    • cmb@php.net
« previous php.doc.bugs (#19246) next »