Bug #77804 [Opn->Nab]: parse_url illegal host

From: Date: Fri, 14 Jun 2019 12:03:55 +0000
Subject: Bug #77804 [Opn->Nab]: parse_url illegal host
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221310@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77804&edit=1

 ID:                 77804
 Updated by:         sjon@php.net
 Reported by:        1085242202 at qq dot com
 Summary:            parse_url  illegal host
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   Red Hat Enterprise Linux Server
 PHP Version:        master-Git-2019-03-27 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

I'm pretty sure the given domain-name is simply incorrect, as \ is not an allowed character
according to https://tools.ietf.org/html/rfc1034

Additionally, the documentation of parse_url says:

> This function is not meant to validate the given URL, it only breaks it up into the above
> listed parts. 

so this is al pretty much expected behaviour


Previous Comments:
------------------------------------------------------------------------
[2019-03-27 08:13:51] 1085242202 at qq dot com

Description:
------------
"var_dump(parse_url('http://baidu.com\pinyin.sogou.com'));"
array(2) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(26) "baidu.com\pinyin.sogou.com"
}
"baidu.com\pinyin.sogou.com" maybe is an illegal host
ps:空格及符号如“?/\;:@#$%^~_=+,8.
。<>”等都不能用在域名命名 https://zhidao.baidu.com/question/337004301.html


Test script:
---------------
var_dump(parse_url('http://baidu.com\pinyin.sogou.com'));
array(2) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(26) "baidu.com\pinyin.sogou.com"
}

Expected result:
----------------
array(2) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(26) "baidu.com"
}

Actual result:
--------------
array(2) {
  ["scheme"]=>
  string(4) "http"
  ["host"]=>
  string(26) "baidu.com\pinyin.sogou.com"
}


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=77804&edit=1


Thread (2 messages)

« previous php.bugs (#221310) next »