ID: 37044
User updated by: dim at dvisionfactory dot com
Reported By: dim at dvisionfactory dot com
-Status: Feedback
+Status: Open
Bug Type: Directory function related
Operating System: FreebBSD
PHP Version: 4.4.2
New Comment:
I've added "clearstatcache()" after "chgrp(..)"!
Now "filegroup()" produces the right output, but it hasn't solved my
problem.
Output of the script:
SUCCESS, 16888, 80, 80
FAIL, 16888, 80, 1005
SUCCESS, 16888, 80, 80
SUCCESS, 1688, 80, 80
Previous Comments:
------------------------------------------------------------------------
[2006-04-11 18:39:42] [EMAIL PROTECTED]
What if you call clearstatcache() between chgrp() and filegroup() calls
?
------------------------------------------------------------------------
[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