reference/stream/functions/stream-get-contents.xml
8f0d3cbca16a0655d88c9dc2c9c5ac486e9ae020
...
...
@@ -8,16 +8,16 @@
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>string</type><methodname>stream_get_contents</methodname>
12
-
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
13
-
<methodparam choice="opt"><type>int</type><parameter>maxlength</parameter><initializer>-1</initializer></methodparam>
11
+
<type class="union"><type>string</type><type>false</type></type><methodname>stream_get_contents</methodname>
12
+
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
13
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>-1</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
Identical to <function>file_get_contents</function>, except that
18
18
<function>stream_get_contents</function> operates on an already open
19
19
stream resource and returns the remaining contents in a string, up to
20
-
<parameter>maxlength</parameter> bytes and starting at the specified
20
+
<parameter>length</parameter> bytes and starting at the specified
21
21
<parameter>offset</parameter>.
22
22
</para>
23
23
</refsect1>
...
...
@@ -27,7 +27,7 @@
27
27
<para>
28
28
<variablelist>
29
29
<varlistentry>
30
-
<term><parameter>handle</parameter> (<type>resource</type>)</term>
30
+
<term><parameter>stream</parameter> (<type>resource</type>)</term>
31
31
<listitem>
32
32
<para>
33
33
A stream resource (e.g. returned from <function>fopen</function>)
...
...
@@ -35,16 +35,16 @@
35
35
</listitem>
36
36
</varlistentry>
37
37
<varlistentry>
38
-
<term><parameter>maxlength</parameter> (<type>integer</type>)</term>
38
+
<term><parameter>length</parameter> (<type>int</type>)</term>
39
39
<listitem>
40
40
<para>
41
-
The maximum bytes to read. Defaults to -1 (read all the remaining
41
+
The maximum bytes to read. Defaults to &null; (read all the remaining
42
42
buffer).
43
43
</para>
44
44
</listitem>
45
45
</varlistentry>
46
46
<varlistentry>
47
-
<term><parameter>offset</parameter> (<type>integer</type>)</term>
47
+
<term><parameter>offset</parameter> (<type>int</type>)</term>
48
48
<listitem>
49
49
<para>
50
50
Seek to the specified offset before reading. If this number is negative,
...
...
@@ -65,26 +65,24 @@
65
65

66
66
<refsect1 role="changelog">
67
67
&reftitle.changelog;
68
-
<para>
69
-
<informaltable>
70
-
<tgroup cols="2">
71
-
<thead>
72
-
<row>
73
-
<entry>&Version;</entry>
74
-
<entry>&Description;</entry>
75
-
</row>
76
-
</thead>
77
-
<tbody>
78
-
<row>
79
-
<entry>5.1.0</entry>
80
-
<entry>
81
-
The <parameter>offset</parameter> was added.
82
-
</entry>
83
-
</row>
84
-
</tbody>
85
-
</tgroup>
86
-
</informaltable>
87
-
</para>
68
+
<informaltable>
69
+
<tgroup cols="2">
70
+
<thead>
71
+
<row>
72
+
<entry>&Version;</entry>
73
+
<entry>&Description;</entry>
74
+
</row>
75
+
</thead>
76
+
<tbody>
77
+
<row>
78
+
<entry>8.0.0</entry>
79
+
<entry>
80
+
<parameter>length</parameter> is now nullable.
81
+
</entry>
82
+
</row>
83
+
</tbody>
84
+
</tgroup>
85
+
</informaltable>
88
86
</refsect1>
89
87

90
88
<refsect1 role="examples">
...
...
@@ -121,6 +119,13 @@ if ($stream = fopen('http://www.example.net', 'r')) {
121
119
<refsect1 role="notes">
122
120
&reftitle.notes;
123
121
&note.bin-safe;
122
+
<note>
123
+
<para>
124
+
When specifying a <parameter>length</parameter> value other than &null;, this function will
125
+
immediately allocate an internal buffer of that size even if the
126
+
actual contents are significantly shorter.
127
+
</para>
128
+
</note>
124
129
</refsect1>
125
130

126
131
<refsect1 role="seealso">
...
...
@@ -134,7 +139,6 @@ if ($stream = fopen('http://www.example.net', 'r')) {
134
139
</para>
135
140
</refsect1>
136
141
</refentry>
137
-

138
142
<!-- Keep this comment at the end of the file
139
143
Local variables:
140
144
mode: sgml
141
145