ID: 27133
User updated by: kulpp at wsg dot net
Reported By: kulpp at wsg dot net
-Status: Bogus
+Status: Open
Bug Type: Filesystem function related
Operating System: Linux
PHP Version: 4.3.4
New Comment:
$filename = tempnam('\tmp', 'test_');
fopen($filename, 'r');
still produces
Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid
is 579 is not allowed to access /tmp/test_YNsKKT owned by uid 18 in ...
Previous Comments:
------------------------------------------------------------------------
[2004-02-03 10:59:40] kulpp at wsg dot net
I understand the documentation on the first parameter. I am
intentionally relying on the rest of documentation that states that it
will use the system default temp space in this case.
PS: it exhibits the exact same behaviour with tempnam('\tmp', 'test_')
The temp file IS being created, but it's not owned with the correct
UID. Doesn't this behaviour make the tempnam function useless under
SAFE MODE?
------------------------------------------------------------------------
[2004-02-03 10:13:44] [EMAIL PROTECTED]
see: http://www.php.net/tempnam
And notice the first parameter you can give it..
This is intentional.
------------------------------------------------------------------------
[2004-02-03 10:12:30] [EMAIL PROTECTED]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
When creating a temporary filename, you should use the 1st
parameter to the function to specify a directory which you
will be able to access.
------------------------------------------------------------------------
[2004-02-03 10:01:49] kulpp at wsg dot net
Description:
------------
Back in 4.0.3, tempnam() was changed to actually create the temp file
to avoid a race condition. It would seem that the current implemntation
is inconsistent with SAFE MODE restrictions which then prevent access
to the filename returned by tempnam().
Reproduce code:
---------------
<%
$filename = tempnam('', 'test_');
fopen($filename, 'r');
%>
Expected result:
----------------
no errors or warnings
Actual result:
--------------
Warning: fopen(): SAFE MODE Restriction in effect. The script whose uid
is 579 is not allowed to access /tmp/test_zSTbRQ owned by uid 18 in
/usr/local/www/docs/test/tempnam_broken.php on line 5
Warning: fopen(/tmp/test_zSTbRQ): failed to open stream: Permission
denied in /usr/local/www/docs/test/tempnam_broken.php on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27133&edit=1