php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80431 parse_url() return fragment, query while there is not.
Submitted: 2020-11-27 08:06 UTC Modified: 2020-11-27 08:11 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kawewong at gmail dot com Assigned:
Status: Closed Package: URL related
PHP Version: 8.0.0 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kawewong at gmail dot com
New email:
PHP Version: OS:

 

 [2020-11-27 08:06 UTC] kawewong at gmail dot com
Description:
------------
If I enter the URL like this "/path?#"
The `parse_url()` function always return fragment and query array key while previous versions of PHP like 5.x, 7.x doesn't return these value if not exists.

Expected result:
----------------
array(
    'path' => '/path',
);

Actual result:
--------------
array(
    'path' => '/path',
    'query' => '',
    'fragment' => '',
);

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-27 08:11 UTC] requinix@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2020-11-27 08:11 UTC] requinix@php.net
This is a deliberate change.
https://www.php.net/manual/en/migration80.incompatible.php
(search for "parse_url")

However, the function's docs could use a Changelog entry.
 [2021-09-24 16:46 UTC] git@php.net
Automatic comment on behalf of cmb69
Revision: https://github.com/php/doc-en/commit/0254e633d2a0cf36c3b3a2ba19350019e12d3b4b
Log: Fix #80431: parse_url() return fragment, query while there is not
 [2021-09-24 16:46 UTC] git@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 03:01:30 2025 UTC