#44884 [Opn->Bgs]: File handling causes issues
| From: | colder@php.net | Date: | Thu, 01 May 2008 19:23:22 +0000 |
| Subject: | #44884 [Opn->Bgs]: File handling causes issues | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-124640@lists.php.net to get a copy of this message | ||
ID: 44884
Updated by: colder@php.net
Reported By: assid at assid dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: debian gnu/linux
PHP Version: 5.2.6RC5
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.
chmod(.., 0666) and not chmod(.., "0666")
Previous Comments:
------------------------------------------------------------------------
[2008-05-01 19:13:59] assid at assid dot com
Description:
------------
5.2.6RC starts behaving very strangely if you have a code that sets
chmod and chown on the new file being uploaded.
This function used to work before, and now it starts causing issues.
It seems to crash on chmod, chown, and chgrp
Reproduce code:
---------------
function handleFileUpload($uploadpath, $filenameprepend, $filesField)
{
$filename = NULL;
if (isset($_FILES[$filesField]['name']) &&
!empty($_FILES[$filesField]['name']) )
{
$pinfo = pathinfo($_FILES[$filesField]['name']);
$extn = strtolower($pinfo['extension']);
$uploaddir = $uploadpath;
$filename = $filenameprepend . '.' . $extn;
$uploadfile = $uploaddir . $filename;
move_uploaded_file($_FILES[$filesField]['tmp_name'], $uploadfile);
sleep(2);
chmod($uploadfile,"0666");
chown($uploadfile,$this->getSystemUser());
chgrp($uploadfile,$this->getSystemGroup());
}
return $filename;
}
Expected result:
----------------
The above code block worked on 5.2.4. I believe this is being caused by
Fixed move_uploaded_file() to always set file permissions of resulting
file according to UMASK. (Andrew Sitnikov)
It should set the mode and ownership and group IF the user is
explicitly coding it in.
Actual result:
--------------
Errors like the following show up
Warning: chown() [function.chown]: Operation not permitted in
/home/chinajapantraders/www/scripts/generalfunctions.php on line 43
Warning: chgrp() [function.chgrp]: Operation not permitted in
/home/chinajapantraders/www/scripts/generalfunctions.php on line 44
chmod doesnt give an error, however, the modes arent being set
correctly either. The modes show up as : --w--wx-wT if i set it as 0666
as mentioned above.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44884&edit=1