language/wrappers/php.xml
ec6e871a47fa15228aa3299f46fed826422adbc0
...
...
@@ -1,7 +1,7 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
3

4
-
<refentry xml:id="wrappers.php" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" role="noversion">
4
+
<refentry xml:id="wrappers.php" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" annotations="verify_info:false">
5
5
<refnamediv>
6
6
<refname>php://</refname>
7
7
<refpurpose>Accessing various I/O streams</refpurpose>
...
...
@@ -25,8 +25,8 @@
25
25
input or output stream of the PHP process. The stream references a
26
26
duplicate file descriptor, so if you open <filename>php://stdin</filename>
27
27
and later close it, you close only your copy of the descriptor-the actual
28
-
stream referenced by <constant>STDIN</constant> is unaffected. Note that
29
-
PHP exhibited buggy behavior in this regard until PHP 5.2.1. It is
28
+
stream referenced by <constant>STDIN</constant> is unaffected.
29
+
It is
30
30
recommended that you simply use the constants <constant>STDIN</constant>,
31
31
<constant>STDOUT</constant> and <constant>STDERR</constant> instead of
32
32
manually opening streams using these wrappers.
...
...
@@ -42,26 +42,12 @@
42
42
<title>php://input</title>
43
43
<simpara>
44
44
<filename>php://input</filename> is a read-only stream that allows you to
45
-
read raw data from the request body. In the case of POST requests, it is
46
-
preferable to use <filename>php://input</filename> instead of <varname>$HTTP_RAW_POST_DATA</varname> as it does not depend
47
-
on special &php.ini; directives. Moreover, for those cases where
48
-
<varname>$HTTP_RAW_POST_DATA</varname> is not populated by default, it is a
49
-
potentially less memory intensive alternative to activating <link
50
-
linkend="ini.always-populate-raw-post-data">always_populate_raw_post_data</link>.
51
-
<filename>php://input</filename> is not available with
52
-
<literal>enctype="multipart/form-data"</literal>.
45
+
read raw data from the request body.
46
+
<filename>php://input</filename> is not available in POST requests with
47
+
<literal>enctype="multipart/form-data"</literal> if
48
+
<link linkend="ini.enable-post-data-reading">enable_post_data_reading</link>
49
+
option is enabled.
53
50
</simpara>
54
-
<note>
55
-
<simpara>
56
-
Prior to PHP 5.6, a stream opened with <filename>php://input</filename>
57
-
could only be read once; the stream did not support seek operations.
58
-
However, depending on the SAPI implementation, it may be possible to open
59
-
another <filename>php://input</filename> stream and restart reading. This
60
-
is only possible if the request body data has been saved. Typically, this
61
-
is the case for POST requests, but not other request methods, such as PUT
62
-
or PROPFIND.
63
-
</simpara>
64
-
</note>
65
51
</refsect2>
66
52

67
53
<refsect2 xml:id="wrappers.php.output">
...
...
@@ -87,7 +73,7 @@
87
73
<simpara>
88
74
<filename>php://memory</filename> and <filename>php://temp</filename> are
89
75
read-write streams that allow temporary data to be stored in a file-like
90
-
wrapper. The only difference between the two is that
76
+
wrapper. One difference between the two is that
91
77
<filename>php://memory</filename> will always store its data in memory,
92
78
whereas <filename>php://temp</filename> will use a temporary file once the
93
79
amount of data stored hits a predefined limit (the default is 2 MB). The
...
...
@@ -100,6 +86,15 @@
100
86
the maximum amount of data to keep in memory before using a temporary
101
87
file, in bytes.
102
88
</simpara>
89
+
<caution>
90
+
<simpara>
91
+
Some PHP extensions may require a standard IO stream,
92
+
and may attempt to cast a given stream to a standard IO stream.
93
+
This cast can fail for memory streams as it requires the C
94
+
<function>fopencookie</function> function to be available.
95
+
This C function is <emphasis>not</emphasis> available on Windows.
96
+
</simpara>
97
+
</caution>
103
98
</refsect2>
104
99

105
100
<refsect2 xml:id="wrappers.php.filter">
...
...
@@ -245,8 +240,8 @@
245
240
<row>
246
241
<entry>Supports <function>stat</function></entry>
247
242
<entry>
248
-
<literal>php://memory</literal> and
249
-
<literal>php://temp</literal> only.
243
+
No. However, <literal>php://memory</literal> and
244
+
<literal>php://temp</literal> support <function>fstat</function>.
250
245
</entry>
251
246
</row>
252
247
<row>
...
...
@@ -281,43 +276,6 @@
281
276
</para>
282
277
</refsect1> <!-- }}} -->
283
278

284
-
<refsect1 role="changelog"><!-- {{{ -->
285
-
&reftitle.changelog;
286
-
<para>
287
-
<informaltable>
288
-
<tgroup cols="2">
289
-
<thead>
290
-
<row>
291
-
<entry>&Version;</entry>
292
-
<entry>&Description;</entry>
293
-
</row>
294
-
</thead>
295
-
<tbody>
296
-
<row>
297
-
<entry>5.6.0</entry>
298
-
<entry>
299
-
<filename>php://input</filename> was made reusable.
300
-
</entry>
301
-
</row>
302
-
<row>
303
-
<entry>5.3.6</entry>
304
-
<entry>
305
-
<filename>php://fd</filename> was added.
306
-
</entry>
307
-
</row>
308
-
<row>
309
-
<entry>5.1.0</entry>
310
-
<entry>
311
-
<filename>php://memory</filename> and <filename>php://temp</filename>
312
-
were added.
313
-
</entry>
314
-
</row>
315
-
</tbody>
316
-
</tgroup>
317
-
</informaltable>
318
-
</para>
319
-
</refsect1><!-- }}} -->
320
-

321
279
<refsect1 role="examples"><!-- {{{ -->
322
280
&reftitle.examples;
323
281
<example><!-- {{{ -->
324
282