ID: 37044
Updated by: [EMAIL PROTECTED]
Reported By: dim at dvisionfactory dot com
-Status: Open
+Status: Feedback
Bug Type: Directory function related
Operating System: FreebBSD
PHP Version: 4.4.2
New Comment:
What if you call clearstatcache() between chgrp() and filegroup() calls
?
Previous Comments:
------------------------------------------------------------------------
[2006-04-11 18:32:00] dim at dvisionfactory dot com
Description:
------------
MKDIR has a strange behaviour. In my case, I tried to the following:
- Create a directory A
- Change group of A
- Create directory B which is a sub-directory of A -> ERROR
I wrote a test case.
The strange thing:
I create directory A by mkdir('A'); and I change it's group by
chgrp('A', 'some_user');. fileowner('A'); return as expected '80' which
is the user 'www', but filegroup('A') also returns '80', although it
should be '1005' (='some_user'). If I now try an 'ls -l' in a shell I
get "www:some_user", which indicates that chgrp('A', 'some_user'); was
successfull.
Reproduce code:
---------------
function mk_dir($dir, $ch_grp = true) {
mkdir($dir);
if (!is_dir($dir)) {
echo 'FAIL';
} else {
chmod($dir, 504);
if ($ch_grp) chgrp($dir, 'some_user');
echo 'SUCCESS';
echo ', ' . fileperms($dir);
echo ', ' . fileowner($dir);
echo ', ' . filegroup($dir);
}
}
mk_dir('/var/www/directory/test1');
// OUTPUT: SUCCESS, 16877, 80, 80
mk_dir('/var/www/directory/test1/test2');
// OUTPUT: FAIL, 16877, 80, 80
rmdir('/var/www/directory/test1/test2'); // CLEAN UP
rmdir('/var/www/directory/test1'); // CLEAN UP
mk_dir('/var/www/directory/test1', false);
// OUTPUT: SUCCESS, 16877, 80, 80
mk_dir('/var/www/directory/test1/test2', false);
// OUTPUT: SUCCESS, 16877, 80, 80
rmdir('/var/www/directory/test1/test2'); // CLEAN UP
rmdir('/var/www/directory/test1'); // CLEAN UP
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37044&edit=1