ID: 41255 Updated by: [EMAIL PROTECTED] Reported By: agrimm61 at gmail dot com -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: Linux PHP Version: 4.4.6 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2007-05-02 00:22:13] agrimm61 at gmail dot com Description: ------------ When moving an uploaded file with move_uploaded_file while php is running in cgi mode the originated file has permissions 600. copy() creates a file with the expected permissions 644. As a result the webserver isn't able to read the file. Safe_Mode is off! Reproduce code: --------------- <? echo umask(); copy($_FILES['userfile']['tmp_name'], "./".$_FILES['userfile']['name'].".copy"); move_uploaded_file($_FILES['userfile']['tmp_name'], "./".$_FILES['userfile']['name']); ?> Expected result: ---------------- output of 18 which is the right umask ( 022 ), so permissions should be set to 644. file moved by copy has permissions 644 file moved by move_uploaded_file has permissions 644 Actual result: -------------- output of 18 which is the right umask ( 022 ), so permissions should be set to 644. file moved by copy has permissions 644 file moved by move_uploaded_file has permissions 600 As a hint i added some lines in basic_functions.c to get the expected behaviour. Here is the patch : --- ext/standard/basic_functions.c.orig 2007-01-01 10:46:47.000000000 +0100 +++ ext/standard/basic_functions.c 2007-05-02 01:43:22.000000000 +0200 @@ -2867,10 +2867,12 @@ VCWD_UNLINK(Z_STRVAL_PP(new_path)); if (rename(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path)) == 0) { + VCWD_CHMOD(Z_STRVAL_PP(new_path),420); successful = 1; } else if (php_copy_file(Z_STRVAL_PP(path), Z_STRVAL_PP(new_path) TSRMLS_CC) == SUCCESS) { VCWD_UNLINK(Z_STRVAL_PP(path)); + VCWD_CHMOD(Z_STRVAL_PP(new_path),420); successful = 1; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41255&edit=1