Issues

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

Description

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 (http://php.net/chmod) the file. In effect this is an octal permission definition rather than a umask.

This is quite misleading.

Comments

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:



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 @@
                         hashed_directory_umaskInteger0700
-                        Umask for the hashed directory structure
+                        Mode that directories in the hashed directory structure are chmoded to
@@ -115,7 +115,7 @@
                         cache_file_umaskInteger0600
-                        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.
+            
+        

Thoughts?

moved to Zend_Cache

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

fixed for 1.12 in r24677 (trunk)

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