Seems several CMS systems have a problem with this (all PHP based).
I stumbled across something in a different system that seems like it could explain it and maybe give a solution. Can anyone confirm if this is an issue in WordPress and its plugins?
This is what I found:
The umask function is invoked in two places in the latest release of CMS Made Simple with "$global_umask"
as the argument. These two invocations are:
cmsmadesimple-1.1/include.php:173: @umask( $global_umask );
The problem is that "$global_umask" is a string value managed as a site preference:
cmsmadesimple-1.1/admin/siteprefs.php:97:$global_umask = '022';
cmsmadesimple-1.1/admin/siteprefs.php:100: $global_umask = $_POST['global_umask'];
cmsmadesimple-1.1/admin/siteprefs.php:197: $global_umask = get_site_preference('global_umask',$global_umask);
cmsmadesimple-1.1/include.php:170:$global_umask = get_site_preference('global_umask','');
PHP converts '022' to the decimal integer value 26 before passing the value to the umask function. It ignores the leading
zero meant to indicate that the string represents an octal value.
To get the correct result, the two invocations of umask listed above need to be changed to:
cmsmadesimple-1.1/admin/siteprefs.php:132: @umask( octdec( $global_umask ) );
cmsmadesimple-1.1/include.php:173: @umask( octdec( $global_umask ) );
Right fix, flawed diagnosis:
PHP converts '022' to the decimal integer value 22 instead of
18, the decimal value of the octal number 22.
However, the problem is the same. The wrong value is passed
to the umask function. An octal value of 26 is used as the mask
(i.e. '022' => 22 => 026).
I really hope the solution could be this simple.... :-)