Bug #76698 [Nab]: mkdir doesn't handle group write permission with 0770 mode
| From: | requinix@php.net | Date: | Fri, 03 Aug 2018 11:48:14 +0000 |
| Subject: | Bug #76698 [Nab]: mkdir doesn't handle group write permission with 0770 mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-216551@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76698&edit=1
ID: 76698
Updated by: requinix@php.net
Reported by: zoeslam at gmail dot com
Summary: mkdir doesn't handle group write permission with
0770 mode
Status: Not a bug
Type: Bug
Package: *Directory/Filesystem functions
Operating System: Debian Stretch
PHP Version: 7.2.8
Block user comment: N
Private report: N
New Comment:
> the umask is for control default permission
No, it applies to default and explicit values. Read the docs.
Previous Comments:
------------------------------------------------------------------------
[2018-08-03 11:44:29] spam2 at rhsoft dot net
the umask is for control default permission while the topic is explicit one!
mkdir also has a problem with permissions when create a recursive directory tree
------------------------------------------------------------------------
[2018-08-03 10:33:46] requinix@php.net
What's your umask?
------------------------------------------------------------------------
[2018-08-03 10:20:05] zoeslam at gmail dot com
Description:
------------
mkdir($dir, 0770) skips group write permission
https://3v4l.org/pKu4U
Test script:
---------------
$dir = uniqid('/tmp/test_0700_');
mkdir($dir, 0700);
$fileperms = 0777 & fileperms($dir);
var_dump(0700 === $fileperms);
var_dump(decoct($fileperms));
$dir = uniqid('/tmp/test_0770_');
mkdir($dir, 0770);
$fileperms = 0777 & fileperms($dir);
var_dump(0770 === $fileperms);
var_dump(decoct($fileperms));
Expected result:
----------------
bool(true)
string(3) "700"
bool(true)
string(3) "770"
Actual result:
--------------
bool(true)
string(3) "700"
bool(false)
string(3) "750"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76698&edit=1