php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79810 BC break in parse_url in PHP 8.0.0-dev
Submitted: 2020-07-08 15:06 UTC Modified: 2020-07-08 15:11 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: wouter at madewithlove dot be Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 8.0.0alpha1 OS: ubuntu
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: wouter at madewithlove dot be
New email:
PHP Version: OS:

 

 [2020-07-08 15:06 UTC] wouter at madewithlove dot be
Description:
------------
When running parse_url on an url ending in `?` (such as https://example.com?), parse_url behaves differently in PHP8.0.0 than it did in PHP 7.x. It now adds a `query` array key containing an empty string, which wasn't the case previously.

Test script:
---------------
var_dump(parse_url('https://example.com?'));

see: https://3v4l.org/etR9T

Expected result:
----------------
array(2) {
  ["scheme"]=>
  string(5) "https"
  ["host"]=>
  string(11) "example.com"
}

The result should be the same as in PHP7.x

Actual result:
--------------
array(3) {
  ["scheme"]=>
  string(5) "https"
  ["host"]=>
  string(11) "example.com"
  ["query"]=>
  string(0) ""
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-08 15:11 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2020-07-08 15:11 UTC] nikic@php.net
This is an intentional change and documented in the upgrading notes: https://github.com/php/php-src/blob/06da048622c46b8322ef651c9dae2ffd68161842/UPGRADING#L430.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC