|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-03-14 13:40 UTC] nigel dot greenway at futurepixels dot co dot uk
Description:
------------
Passing hyphenated username and passwords as part of a url to `url_parse` returns false.
Test script:
---------------
<?php
var_dump(
parse_url('http://some:password@ex-ample.co.uk'),
parse_url('http://so-me:password@192.168.0.123'),
parse_url('http://some:pass-word@192.168.0.123')
);
Expected result:
----------------
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(14) "ex-ample.co.uk"
["user"]=>
string(4) "some"
["pass"]=>
string(8) "password"
}
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(14) "192.168.0.123"
["user"]=>
string(4) "so-me"
["pass"]=>
string(8) "password"
}
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(14) "192.168.0.123"
["user"]=>
string(4) "some"
["pass"]=>
string(8) "pass-word"
}
Actual result:
--------------
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(14) "ex-ample.co.uk"
["user"]=>
string(4) "some"
["pass"]=>
string(8) "password"
}
bool(false)
bool(false)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
The same problem occurs with a space in the password. I am aware that this might not be a valid URL as is (space should be escaped) however this used to work on PHP 7.0 <?php $x = parse_url('http://foo:foo bar@example.com/'); var_dump($x); ?>