ZF-12047: Zend_Cache_Backend_File cache_file_umask and hashed_directory_umask are not umasks but octal permissions

Issue Type: Bug Created: 2012-02-09T11:55:28.000+0000 Last Updated: 2012-03-12T21:31:00.000+0000 Status: Resolved Fix version(s): - 1.12.0 (27/Aug/12)

Reporter: Benoit Dubertret (benoitdub) Assignee: Marc Bennewitz (private) (mabe) Tags: - Zend_Cache

  • zf-caretaker-adamlundrigan
  • zf-crteam-review

Related issues: - ZF-11633

Attachments: - ZF-12047.patch


The documentation and class uses the name "umask" for what is not an umask (see umask(2) man page for the definition : "umask() sets the calling process's file mode creation mask (umask) to mask & 0777"). Rather, the Zend_Cache_Backend_File uses the option "cache_file_umask" to chmod ( the file. In effect this is an octal permission definition rather than a umask.

This is quite misleading.


Posted by Adam Lundrigan (adamlundrigan) on 2012-02-22T23:29:04.000+0000

Indeed. I've updated the documentation (inline and manual) to make note of the fact that the option name contains 'umask' but intent is actually octal file mode:

<pre class="highlight">

Index: library/Zend/Cache/Backend/File.php
--- library/Zend/Cache/Backend/File.php (revision 24626)
+++ library/Zend/Cache/Backend/File.php (working copy)
@@ -71,7 +71,8 @@
      * for you. Maybe, 1 or 2 is a good start.
      * =====> (int) hashed_directory_umask :
-     * - Umask for hashed directory structure
+     * - Mode to chmod hashed directory structure to
+     *   NOTE: ensure you use an octal file mode (chmod) and not a umask value
      * =====> (string) file_name_prefix :
      * - prefix for cache files
@@ -79,7 +80,8 @@
      *   (like /tmp) can cause disasters when cleaning the cache
      * =====> (int) cache_file_umask :
-     * - Umask for cache files
+     * - Mode to chmod cache files to
+     *   NOTE: ensure you use an octal file mode (chmod) and not a umask value
      * =====> (int) metatadatas_array_max_size :
      * - max size for the metadatas array (don't change this value unless you
Index: documentation/manual/en/module_specs/Zend_Cache-Backends.xml
--- documentation/manual/en/module_specs/Zend_Cache-Backends.xml        (revision 24626)
+++ documentation/manual/en/module_specs/Zend_Cache-Backends.xml        (working copy)
@@ -95,7 +95,7 @@
-                        Umask for the hashed directory structure
+                        Mode that directories in the hashed directory structure are chmoded to
@@ -115,7 +115,7 @@
-                        umask for cache files
+                        Mode that cache files are chmoded to
@@ -131,6 +131,13 @@
+            A note about cache_file_umask and hashed_directory_umask
+                Despite having 'umask' in their names, these options set the octal file mode which will be passed to the chmod PHP function.  Be aware that you are not mistakenly passing a umask value, which is the inverse of the file mode.  The file mode defines the permissions to grant, whereas umask defines the permissions not to grant.


Posted by Marc Bennewitz (private) (mabe) on 2012-03-10T10:05:02.000+0000

moved to Zend_Cache

Posted by Marc Bennewitz (private) (mabe) on 2012-03-10T10:59:22.000+0000

Added patch: - added *_perm options - *_umask triggers E_USER_DEPRECATED error and move value to *_perm options

Posted by Marc Bennewitz (private) (mabe) on 2012-03-12T21:29:37.000+0000

fixed for 1.12 in r24677 (trunk)

Posted by Marc Bennewitz (private) (mabe) on 2012-03-12T21:31:00.000+0000

note: triggers E_USER_NOTICE instead of E_USER_DEPRECATED because E_USER_DEPRECATED doesn't exist on PHP < 5.3

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.