From:             mateusz at heleniak dot net
Operating system: Apache, Unix
PHP version:      5.1.2
PHP Bug Type:     Directory function related
Bug description:  mkdir($dir, 0777, true) does NOT chmod created directory

Description:
------------
Directory files/tmp/ has 777 chmod. Script creates files/tmp/tpl-cache/
with 755 chmod!

I use recursive because $foo can be 'admin/asf.tpl' too - then there are 2
directory to create.

I have seen this bug on PHP Version 5.0.4. It wasn't reported here so
probably newest version of PHP has this bug too.

PHP5 is installed as CGI or something similar.

Please help!

I see now this: http://bugs.php.net/bug.php?id=19757 But I can reed on
php.net/umask that: "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."

So.. maybe we can change something to easier using mkdir()?

Reproduce code:
---------------
define('ROOT', dirname(__FILE__).'/');

$foo = 'asf.tpl'; // sample data
$dir = dirname(ROOT.'files/tmp/tpl-cache/'.$foo.'.html');

if(!is_dir($dir) && !mkdir($dir, 0777, true))
{
        die('Can not create directory structure for cached files.');
}

Expected result:
----------------
Directory with 777 chmod.

Actual result:
--------------
Directory with 755 chmod.

-- 
Edit bug report at http://bugs.php.net/?id=37027&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37027&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=37027&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37027&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37027&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37027&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37027&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37027&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37027&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37027&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37027&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37027&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37027&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37027&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37027&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37027&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37027&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37027&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37027&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37027&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37027&r=mysqlcfg

Reply via email to