Doc #55804 [Opn]: tempnam(): wrong fallback to /tmp
| From: | spam2 at rhsoft dot net | Date: | Sat, 18 Apr 2015 08:25:53 +0000 |
| Subject: | Doc #55804 [Opn]: tempnam(): wrong fallback to /tmp | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12195@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55804&edit=1
ID: 55804
User updated by: spam2 at rhsoft dot net
Reported by: spam2 at rhsoft dot net
Summary: tempnam(): wrong fallback to /tmp
Status: Open
Type: Documentation Problem
Package: Filesystem function related
Operating System: Linux
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
boah falling back to /tmp when it is not inide open_basedir() is *plain wrong* because you can not
access the created file - it's hard to understand how idiotic the discussions in context of
clear bugs are all the time
THIS IS NOT A DOCUMENTATION PROBLEM
YOU MUST NOT CREATE A FILE UNTOLD OUTSIDE OPEN_BASEDIR
THE ONLY EXCEPTION IS SESSION-FILES AND UPLOADTEMP
Previous Comments:
------------------------------------------------------------------------
[2015-04-18 05:37:35] php at geheimeinformatie dot nl
> Even a notice might be considered a BC break.
This is arguable at best, but I'm sure the PHP team have thought this through more often than I
have.
So we can either wait for 7.1 or just roll our eyes, sigh deeply, and deal with it? Righty-oh.
------------------------------------------------------------------------
[2015-04-18 00:35:07] cmb@php.net
> I *get* falling back to sensible defaults, but is a simple
> warning too much to ask?
Even a notice might be considered a BC break.
> And the fallback behavios should vanish in PHP7
I'm afraid this ship has sailed[1].
I'm switching the issue to "Documentation Problem".
[1] <https://wiki.php.net/rfc/php7timeline>
------------------------------------------------------------------------
[2015-04-18 00:33:21] cmb@php.net
The following patch has been added/updated:
Patch Name: doc-55804
Revision: 1429317201
URL: https://bugs.php.net/patch-display.php?bug=55804&patch=doc-55804&revision=1429317201
------------------------------------------------------------------------
[2015-03-24 10:37:46] php at geheimeinformatie dot nl
Even without an open_basedir restriction in place, the following script:
<?php
ini_set( "error_reporting", 2047 );
ini_set( "display_errors", 1 );
var_dump( tempnam( "/etc", "wtf-" ) );
?>
just yields the output 'string(15) "/tmp/wtf-xxxxxx"'.
There's no PHP warning, or any sort of indication that the operation failed. The only way to
tell the write failed is to manually verify that the file in question is actually in the specified
folder.
I *get* falling back to sensible defaults, but is a simple warning too much to ask?
I can also verify that this is indeed documented behaviour, but quite frankly I didn't start
looking for this, let's face it, this *footnote* in the docs until after I bricked multiple
servers. (Running out of disk space on Linux is not pretty.)
------------------------------------------------------------------------
[2015-01-19 16:48:15] jo at feuersee dot de
May I propose to clarify the documentation then, pls? It currently reads: "If the directory
does not exist, tempnam() may generate a file in the system's temporary directory, and return
the full path to that file, including its name."
In fact it should hint the permission relation:
"If the directory does not exist or is not writeable ..."
And the fallback behavios should vanish in PHP7
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=55804
--
Edit this bug report at https://bugs.php.net/bug.php?id=55804&edit=1