[php-maint] Bug#358819: result with other modes

Christian Stadler stadler at ragnarokonline.de
Fri Mar 24 16:31:51 UTC 2006

Hash: SHA1

tech at mediaforest.net schrieb:
> other precisions :
> when running mkdir("dirname",1777) dirname is created with d-wxr----t
> rights
> when running mkdir("dirname",2777) dirname is created with d-wx--x--t
> rights
> when running mkdir("dirname",3777) dirname is created with d-wx-----t
> rights
> when running mkdir("dirname",4777) dirname is created with d-w-r-x--t
> rights
> when running mkdir("dirname",5777) dirname is created with d-w------t
> rights
> when running mkdir("dirname",6777) dirname is created with d--xr-x--t
> rights
> when running mkdir("dirname",7777) dirname is created with d--xr----t
> rights
> and of course,  when running mkdir("dirname") without the optionnal mode
> parameter, dirname is created with drwxr-xr-x instead of the default
> rights drwxrwxrwx !

Its not a bug, its a feature. You should read http://www.php.net/umask
and the manpage of umask about that.

If if don't want to get the file-permissions masked by the umask, you
could do the following:

$perms = 0777;

$oldumask = umask(0); // Sets the umask to 0 (=> disables it)
mkdir($dirname, $perms);
umask($oldumask);     // restores the old umask

  Christian Stadler
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the pkg-php-maint mailing list