php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64846 Documentation says parse_url doesn't work with relative urls but it does
Submitted: 2013-05-15 18:42 UTC Modified: 2017-05-29 14:05 UTC
From: alias dot mac at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: *URL Functions
PHP Version: 5.3.25 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alias dot mac at gmail dot com
New email:
PHP Version: OS:

 

 [2013-05-15 18:42 UTC] alias dot mac at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.parse-url#refsect1-function.parse-
url-notes
---

It has on the notes:
"This function doesn't work with relative URLs."

But with my test script looks like it is working just fine:

$ php --version
PHP 5.3.20 (cli) (built: Jan 21 2013 15:03:13)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans


Test script:
---------------
<?php

$x = 'http://example.com/path/to/somewhere?param1=x&param2=http://another.example.com/path/to/another/example/';

var_dump(parse_url($x));

$y = 'path/to/somewhere?param1=x&param2=http://another.example.com/path/to/another/example/';

var_dump(parse_url($y));



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-24 10:29 UTC] peehaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: peehaa
 [2013-07-24 10:29 UTC] peehaa@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2017-05-28 19:27 UTC] osmanov@php.net
The note is still there.
 [2017-05-28 20:25 UTC] requinix@php.net
-Status: Closed +Status: Re-Opened -Package: Documentation problem +Package: *URL Functions
 [2017-05-29 13:22 UTC] peehaa@php.net
-Assigned To: peehaa +Assigned To:
 [2017-05-29 13:22 UTC] peehaa@php.net
I did make the change in 2013 https://svn.php.net/viewvc?view=revision&revision=331013.

But people started shouting at me that it was *not* officially supported and my change was wrong. Hence I reverted.

So ¯\_(ツ)_/¯, if somebody else wants to make this change and/or close this bug report feel free to go for it :-)
 [2017-05-29 14:05 UTC] requinix@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: peehaa
 [2017-05-29 14:05 UTC] requinix@php.net
Sounds like there was a good reason, then. So in practice relative URLs tend to work but some forms will be able to fool the parser.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 15:01:28 2024 UTC