php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19757 odd mkdir vrs chmod fileperms
Submitted: 2002-10-04 14:31 UTC Modified: 2002-10-04 14:35 UTC
From: fandelem at hotmail dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.2.0 OS: linux 2.4.9-7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: fandelem at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-10-04 14:31 UTC] fandelem at hotmail dot com
This is reproducable, though very odd.

I have a script that does this:

mkdir("fandelem",0777);


which when I issue 'ls -la' produces:
drwxr-xr-x    2 apache   apache       4096 Oct  4 11:16 fandelem

However when I add:

chmod("fandelem",0777);

which when I issue 'ls -la' produces:
drwxrwxrwx    2 apache   apache       4096 Oct  4 11:19 fandelem

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

I don't really understand why -- and I guess I could just have the code do an extra chmod() but I found it quite odd that this happens.

-kyle

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-04 14:35 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The mkdir call is affected by umask. Since on most systems (unix) default umask is 022 when it is applied to mode 0777 you get 755 directory permission.
To avoid this problem, do a call umask(0), before creating a directory.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 23 01:01:23 2020 UTC