note 14811 added to function.mkdir.php

From: Date: Wed, 15 Aug 2001 19:19:21 +0000
Subject: note 14811 added to function.mkdir.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16760@lists.php.net to get a copy of this message
I just wanted to clarify why the umask isn't technically being subtracted. Suppose you want to make sure that no file gets created with write permission for everyone. You would use the umask: 0002 (-------w-) If you then created a directory with the following permissions: 0774 (rwxrwx--x) subtraction would yield: 0772 (rwxrwx-w-) which is exactly what you DIDN'T want. That's why instead, the umask is inverted then "BITWISE AND"ed to negate the umask's bit(s) and preserve any existing bits: 775 (rwxrwxr-x) & (bitwise AND) 774 (rwxrwx--x) = 774 (rwxrwx--x) http://www.php.net/manual/en/function.mkdir.php

« previous php.notes (#16760) next »