Bug #76698 [Com]: mkdir doesn't handle group write permission with 0770 mode

From: Date: Fri, 03 Aug 2018 11:54:35 +0000
Subject: Bug #76698 [Com]: mkdir doesn't handle group write permission with 0770 mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216552@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
 Comment by:         spam2 at rhsoft dot 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:

wrong behavior doesn't get better by nosense in docs
when i say 0770 i mean 0770, full stop

if i need to fire up a chmod after mkdir to have a conrtolled behavior please remove that idiotic
parameter entirely so people are awarw - hopefully next you don't tell me chmod() has also
ramndom behavior

frankly the whole point for the chmod param is that in case of umasks you you can make sure that
your script set what you say nd not relies on arbitary local defaults


Previous Comments:
------------------------------------------------------------------------
[2018-08-03 11:48:14] requinix@php.net

> the umask is for control default permission
No, it applies to default and explicit values. Read the docs.

------------------------------------------------------------------------
[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


Thread (11 messages)

« previous php.bugs (#216552) next »