ID: 37044
User updated by: dim at dvisionfactory dot com
Reported By: dim at dvisionfactory dot com
-Status: Bogus
+Status: Open
Bug Type: Directory function related
Operating System: FreebBSD
PHP Version: 4.4.2
New Comment:
Sorry, forgot to point out that it also works fine for me on Linux. It
fails only on FreeBSD (I use version 6.0).
phpinfo:
allow_call_time_pass_reference On On
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors Off Off
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2039 2039
expose_php On On
extension_dir /usr/local/lib/php/20020429
/usr/local/lib/php/20020429
file_uploads On On
gpc_order GPC GPC
html_errors Off Off
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .: .:
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
memory_limit 48M 48M
open_basedir /usr/local/www/some_site/:/usr/local/se/ no value
output_buffering no value no value
output_handler no value no value
post_max_size 8M 8M
precision 12 12
register_argc_ar On On
register_globals Off Off
report_memleaks On On
safe_mode On On
safe_mode_exec_dir /usr/local/se/ /usr/local/se/
safe_mode_gid On On
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i
/usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 20M 20M
upload_tmp_dir no value no value
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
Previous Comments:
------------------------------------------------------------------------
[2006-04-12 08:26:22] [EMAIL PROTECTED]
Works perfectly fine here.
------------------------------------------------------------------------
[2006-04-12 08:00:36] dim at dvisionfactory dot com
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
------------------------------------------------------------------------
[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