php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53371 parse_url docs say it returns FALSE on malformed URLs. It may return NULL.
Submitted: 2010-11-21 17:28 UTC Modified: 2010-11-23 12:36 UTC
From: brianlmoon@php.net Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.3 OS: All
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: brianlmoon@php.net
New email:
PHP Version: OS:

 

 [2010-11-21 17:28 UTC] brianlmoon@php.net
Description:
------------
From the docs:

"On seriously malformed URLs, parse_url() may return FALSE. Otherwise an associative array is returned, whose components may be (at least one):"

However, in some cases it will return NULL as well. Actually, I am having a really hard time getting it to return FALSE. I am not sure it ever does. I know it will throw a warning at times. But, it does not even seem to do that on an empty string.

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

var_dump(parse_url("1,2,3,4", PHP_URL_QUERY));
var_dump(parse_url("1,2,3,4"));

?>

Expected result:
----------------
The documentation should state that the function returns NULL when the 2nd parameter is used and the requested portion of the URL is not not set.

Actual result:
--------------
The documentation makes no mention of the function ever returning NULL.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-23 12:29 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2010-11-23 12:36 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2010-11-23 12:36 UTC] aharvey@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.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 13:00:01 2026 UTC