reference/filesystem/functions/tempnam.xml
d1cacac75c04a115ee9b464015ce8e7782bd1517
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.tempnam">
3
+
<refentry xml:id="function.tempnam" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>tempnam</refname>
6
6
<refpurpose>Create file with unique file name</refpurpose>
...
...
@@ -9,15 +9,15 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>tempnam</methodname>
13
-
<methodparam><type>string</type><parameter>dir</parameter></methodparam>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>tempnam</methodname>
13
+
<methodparam><type>string</type><parameter>directory</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>prefix</parameter></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
Creates a file with a unique filename, with access permission set to 0600, in the specified directory.
18
-
If the directory does not exist, <function>tempnam</function> may
18
+
If the directory does not exist or is not writable, <function>tempnam</function> may
19
19
generate a file in the system's temporary directory, and return
20
-
the name of that.
20
+
the full path to that file, including its name.
21
21
</para>
22
22
</refsect1>
23
23

...
...
@@ -26,7 +26,7 @@
26
26
<para>
27
27
<variablelist>
28
28
<varlistentry>
29
-
<term><parameter>dir</parameter></term>
29
+
<term><parameter>directory</parameter></term>
30
30
<listitem>
31
31
<para>
32
32
The directory where the temporary filename will be created.
...
...
@@ -41,7 +41,8 @@
41
41
</para>
42
42
<note>
43
43
<simpara>
44
-
Windows uses only the first three characters of prefix.
44
+
Only the first 63 characters of the prefix are used, the rest are ignored.
45
+
Windows uses only the first three characters of the prefix.
45
46
</simpara>
46
47
</note>
47
48
</listitem>
...
...
@@ -53,51 +54,32 @@
53
54
<refsect1 role="returnvalues">
54
55
&reftitle.returnvalues;
55
56
<para>
56
-
Returns the new temporary filename, or &false; on
57
+
Returns the new temporary filename (with path), or &false; on
57
58
failure.
58
59
</para>
59
60
</refsect1>
60
61

61
62
<refsect1 role="changelog">
62
63
&reftitle.changelog;
63
-
<para>
64
-
<informaltable>
65
-
<tgroup cols="2">
66
-
<thead>
67
-
<row>
68
-
<entry>&Version;</entry>
69
-
<entry>&Description;</entry>
70
-
</row>
71
-
</thead>
72
-
<tbody>
73
-
<row>
74
-
<entry>4.0.6</entry>
75
-
<entry>
76
-
Prior to PHP 4.0.6, the behaviour of the
77
-
<function>tempnam</function> function was system dependent. On
78
-
Windows the <varname>TMP</varname> environment variable will override the
79
-
<parameter>dir</parameter> parameter, on Linux the <varname>TMPDIR</varname>
80
-
environment variable has precedence, while SVR4 will always use
81
-
your <parameter>dir</parameter> parameter if the directory it
82
-
points to exists. Consult your system documentation on the
83
-
tempnam(3) function if in doubt.
84
-
</entry>
85
-
</row>
86
-
<row>
87
-
<entry>4.0.3</entry>
88
-
<entry>
89
-
This function's behavior changed in 4.0.3. The temporary file is also
90
-
created to avoid a race condition where the file might appear in the
91
-
filesystem between the time the string was generated and before
92
-
the script gets around to creating the file. Note, that you need
93
-
to remove the file in case you need it no more, it is not done
94
-
automatically.
95
-
</entry>
96
-
</row>
97
-
</tbody>
98
-
</tgroup>
99
-
</informaltable>
100
-
</para>
64
+
<informaltable>
65
+
<tgroup cols="2">
66
+
<thead>
67
+
<row>
68
+
<entry>&Version;</entry>
69
+
<entry>&Description;</entry>
70
+
</row>
71
+
</thead>
72
+
<tbody>
73
+
<row>
74
+
<entry>7.1.0</entry>
75
+
<entry>
76
+
<function>tempnam</function> now emits a notice when falling back to the
77
+
temp directory of the system.
78
+
</entry>
79
+
</row>
80
+
</tbody>
81
+
</tgroup>
82
+
</informaltable>
101
83
</refsect1>
102
84

103
85
<refsect1 role="examples">
...
...
@@ -114,7 +96,7 @@ $handle = fopen($tmpfname, "w");
114
96
fwrite($handle, "writing to tempfile");
115
97
fclose($handle);
116
98

117
-
// do here something
99
+
// do something here
118
100

119
101
unlink($tmpfname);
120
102
?>
...
...
@@ -128,9 +110,9 @@ unlink($tmpfname);
128
110
&reftitle.notes;
129
111
<note>
130
112
<simpara>
131
-
If PHP cannot create a file in the specified <parameter>dir</parameter>
113
+
If PHP cannot create a file in the specified <parameter>directory</parameter>
132
114
parameter, it falls back on the system default. On NTFS this also happens
133
-
if the specified <parameter>dir</parameter> contains more than 65534 files.
115
+
if the specified <parameter>directory</parameter> contains more than 65534 files.
134
116
</simpara>
135
117
</note>
136
118
</refsect1>
...
...
@@ -147,7 +129,6 @@ unlink($tmpfname);
147
129
</refsect1>
148
130

149
131
</refentry>
150
-

151
132
<!-- Keep this comment at the end of the file
152
133
Local variables:
153
134
mode: sgml
154
135