reference/url/functions/parse-url.xml
4266e03897e77751a6cf7d15f9556c92124d8df3
4266e03897e77751a6cf7d15f9556c92124d8df3
...
...
@@ -9,7 +9,7 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>mixed</type><methodname>parse_url</methodname>
12
+
<type class="union"><type>int</type><type>string</type><type>array</type><type>null</type><type>false</type></type><methodname>parse_url</methodname>
13
13
<methodparam><type>string</type><parameter>url</parameter></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>component</parameter><initializer>-1</initializer></methodparam>
15
15
</methodsynopsis>
...
...
@@ -20,10 +20,19 @@
20
20
</para>
21
21
<para>
22
22
This function is <emphasis role="strong">not</emphasis> meant to validate
23
-
the given URL, it only breaks it up into the above listed parts. Partial and invalid
23
+
the given URL, it only breaks it up into the parts listed below. Partial and invalid
24
24
URLs are also accepted, <function>parse_url</function> tries its best to
25
25
parse them correctly.
26
26
</para>
27
+
<caution>
28
+
<para>
29
+
This function may not give correct results for relative or invalid URLs,
30
+
and the results may not even match common behavior of HTTP clients.
31
+
If URLs from untrusted input need to be parsed, extra validation is
32
+
required, e.g. by using <function>filter_var</function> with the
33
+
<constant>FILTER_VALIDATE_URL</constant> filter.
34
+
</para>
35
+
</caution>
27
36
</refsect1>
28
37
29
38
<refsect1 role="parameters">
...
...
@@ -72,7 +81,7 @@
72
81
<itemizedlist>
73
82
<listitem>
74
83
<simpara>
75
-
<varname remap="structfield">scheme</varname> - e.g. http
84
+
<varname remap="structfield">scheme</varname> - e.g. <literal>http</literal>
76
85
</simpara>
77
86
</listitem>
78
87
<listitem>
...
...
@@ -252,17 +261,12 @@ array(3) {
252
261
253
262
<refsect1 role="notes">
254
263
&reftitle.notes;
255
-
<note>
256
-
<para>
257
-
This function may not give correct results for relative URLs.
258
-
</para>
259
-
</note>
260
264
<note>
261
265
<para>
262
266
This function is intended specifically for the purpose of parsing URLs
263
267
and not URIs. However, to comply with PHP's backwards compatibility
264
-
requirements it makes an exception for the file:// scheme where triple
265
-
slashes (file:///...) are allowed. For any other scheme this is invalid.
268
+
requirements it makes an exception for the <literal>file://</literal> scheme where triple
269
+
slashes (<literal>file:///...</literal>) are allowed. For any other scheme this is invalid.
266
270
</para>
267
271
</note>
268
272
</refsect1>
...
...
@@ -281,7 +285,6 @@ array(3) {
281
285
</para>
282
286
</refsect1>
283
287
</refentry>
284
-
285
288
<!-- Keep this comment at the end of the file
286
289
Local variables:
287
290
mode: sgml
288
291