Fix #80431: parse_url() return fragment, query while there is not

This commit is contained in:
Christoph M. Becker 2021-09-24 18:46:45 +02:00
parent e95ae8d94c
commit 0254e633d2
No known key found for this signature in database
GPG key ID: D66C9593118BCCB6

View file

@ -118,6 +118,23 @@
<type>int</type>, in the case of <constant>PHP_URL_PORT</constant>)
instead of an <type>array</type>. If the requested component doesn't exist
within the given URL, &null; will be returned.
As of PHP 8.0.0, <function>parse_url</function> distinguishes absent and empty
queries and fragments:
</para>
<para>
<informalexample>
<screen>
<![CDATA[
http://example.com/foo → query = null, fragment = null
http://example.com/foo? → query = "", fragment = null
http://example.com/foo# → query = null, fragment = ""
http://example.com/foo?# → query = "", fragment = ""
]]>
</screen>
</informalexample>
</para>
<para>
Previously all cases resulted in query and fragment being &null;.
</para>
<para>
Note that control characters (cf. <function>ctype_cntrl</function>) in the
@ -125,6 +142,29 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
<function>parse_url</function> will now distinguish absent and empty queries
and fragments.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>