ZF2-377: Storage\Adapter\Filesystem: Wrong file permissions on multithreaded webservers

Issue Type: Bug Created: 2012-06-25T08:22:55.000+0000 Last Updated: 2012-07-23T18:03:45.000+0000 Status: Resolved Fix version(s): Reporter: Marc Bennewitz (private) (mabe) Assignee: Marc Bennewitz (private) (mabe) Tags: - Zend\Cache

Related issues: Attachments:


The filesystem storage adapter is using umask to set file and directory permissions. {quote} Note:

Avoid using this function in multithreaded webservers. It is better to change the file permissions with chmod() after creating the file. Using umask() can lead to unexpected behavior of concurrently running scripts and the webserver itself because they all use the same umask. {quote}

So on multithreaded webservers it's required to set the permissions after the file has been created and only reset a changed umask if the umask didn't changed again. Because it's not possible to autodetect multithreaded webserver environments it have to be configurable and should be enabled by default to work well by default.

Additionally it should be enough to configure one umask (instead of split file / directory umask): umask = 022 $dirPerm = 511 & ~$umask = 0744 $filePerm = 438 & ~$umask = 0644


Posted by Marc Bennewitz (private) (mabe) on 2012-07-17T20:03:11.000+0000

PR opened:

Posted by Maks 3w (maks3w) on 2012-07-23T18:03:45.000+0000

Patch merged

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.