From: 4u at direct-netware dot de
Operating system: Linux in general
PHP version: Irrelevant
PHP Bug Type: Feature/Change Request
Bug description: Change SAFE MODE behavior for new dirs or files

Description:
------------
Every time a script wants to create a directory and a file in it, it fails
because of SAFE MODE restrictions (uid). Please note, that this is only
true, if uid control is active.

Reproduce code:
---------------
<?php
mkdir ("mydir",0777);
$fp = fopen ("mydir/myfile.php","w");
fclose ($fp);
?>

Expected result:
----------------
a) Directory does not exist
Directory will be created using the UID of the script and afterwards
create the file.

b) Directory does exist
A warning (or notice? or whatever it is) will be printed out because the
directory already exists and afterwards the file will still be created.
Expecting the right UID (same as the script) has created the directory.

I want to request, that files and directories are always have the UID of
the script (and the UID of the "uploader") rather than the UID of the
server which causes many providers to disturb normal PHP file actions.

Actual result:
--------------
a) Directory does not exist
Directory will be created using the server UID and afterwards there will
be an error while creating the file (SAFE MODE ...).

b) Directory does exist
A warning (or notice? or whatever it is) will be printed out because the
directory already exists and afterwards the file will not be created
because the script is not allowed to write in the directory (SAFE MODE ...
UID ...).

--
Edit bug report at [url]http://bugs.php.net/?id=25411&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25411&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25411&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25411&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25411&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25411&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25411&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25411&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25411&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25411&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25411&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25411&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25411&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25411&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25411&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25411&r=gnused[/url]