|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19876 Problem with parse_url() function...
Submitted: 2002-10-11 22:54 UTC Modified: 2002-10-12 15:11 UTC
From: onionman at home dot se Assigned:
Status: Closed Package: *URL Functions
PHP Version: 4CVS-2002-10-12 OS: Windows 2000 Pro (Sp3)
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.
Block user comment
Status: Assign to:
Bug Type:
From: onionman at home dot se
New email:
PHP Version: OS:


 [2002-10-11 22:54 UTC] onionman at home dot se
Snapshot used:

This simple script parses an ftp-url:

	$url = "";
	$parts = parse_url($url);
	echo '<pre>'."\n";
	echo print_r($parts)."\n";
	echo '</pre>'."\n";

When i run the script i get this output:

    [scheme] => ftp
    [host] =>
    [user] => gandalf
    [pass] => mello
    [path] => /foo/bar/index.php
    [query] => page=news

Note the cropped password value... it is cropped by one charachter... last snapshot i tested (2002-10-06) did not have this behaviour.

BTW: What does the 1 that is output after the value pairs mean?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-11 23:00 UTC]
The 1 comes from 'echo print_r' you do not need to echo print_r() it'll do it automatically. The missing letter is something I am unable to replicate on any of my machines. Could you please should output of phpinfo() on your system, maybe that'll yeild some clues.
 [2002-10-11 23:26 UTC] onionman at home dot se
Here's a link to the phpinfo at my machine:

A weird thing i noticed is that if i have 'html_errors = Off' in my php.ini file, then phpinfo looses all it formatting and is unreadable... is it supposed to be like this?

Anyway... i doublechecked the parse_url bug by going back to an older snapshot (2002-10-06), and there it works like expected... and then trying latest snap again (2002-10-12), and there it's the same result as before... so either something has introduced a bug there since last week... or my machine is behaving strange... ;)

 [2002-10-11 23:31 UTC]
The lack for formatting for phpinfo() when html_errors are Off is intentional. 

parse_url() was recently rewritten from scratch that probably introduced the bug you are seeing. I'll look into it in more detail.
 [2002-10-12 03:28 UTC]
Please wait until the next developer snapshot is generated and try again.

 [2002-10-12 12:56 UTC] onionman at home dot se
I just tried this snap:

The result is different, but still incorrect:

    [scheme] => ftp
    [host] =>
    [user] => gandalf
    [pass] => :mellon@
    [path] => /foo/bar/index.php
    [query] => page=news

host & pass values are wrong...

 [2002-10-12 14:29 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

The latest snapshot has this problem fixed.
 [2002-10-12 15:11 UTC] onionman at home dot se
Yep... tested it, and it works fine now.

Thanks for the fast response and fix!  :)

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed May 31 16:03:37 2023 UTC