note 99810 deleted from function.mkdir by crell

From: Date: Wed, 29 Jun 2022 19:39:23 +0000
Subject: note 99810 deleted from function.mkdir by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-218733@lists.php.net to get a copy of this message
Note Submitter: satis at clankiller dot com ---- Please note that in a shared environment I failed to take into account an existing umask when I did a mkdir(dirname, 0755). This ended up creating the directory (function returned true), but I didn't have rights to do anything inside the folder, nor could I even view that it existed via ftp. However, file_exists(dirname) returned true. Eventually I figured out what happened and was able to rmdir(dirname), then created the directory correctly. So, when writing scripts you expect to be portable, either use umask to set your umask accordingly, or do a straight mkdir(dirname) followed by chmod(dirname, 0755) (or whatever it is you're looking for). If you make the same mistake I did, you should be able to rmdir() or chmod() the folder so it's accessible.

« previous php.notes (#218733) next »