Skip to content

Commit 9df6112

Browse files
committed
Merge branch 'PHP-7.1'
2 parents c8fe175 + 9c1c8be commit 9df6112

13 files changed

+133
-106
lines changed

ext/standard/tests/strings/url_t.phpt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,22 @@ $sample_urls = array (
575575
string(16) "some_page_ref123"
576576
}
577577

578-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: bool(false)
578+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
579+
["scheme"]=>
580+
string(4) "http"
581+
["host"]=>
582+
string(11) "www.php.net"
583+
["port"]=>
584+
int(80)
585+
["user"]=>
586+
string(14) "secret@hideout"
587+
["path"]=>
588+
string(10) "/index.php"
589+
["query"]=>
590+
string(31) "test=1&test2=char&test3=mixesCI"
591+
["fragment"]=>
592+
string(16) "some_page_ref123"
593+
}
579594

580595
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
581596
["scheme"]=>
@@ -744,7 +759,22 @@ $sample_urls = array (
744759
string(7) "9130731"
745760
}
746761

747-
--> http://user:@pass@host/path?argument?value#etc: bool(false)
762+
--> http://user:@pass@host/path?argument?value#etc: array(7) {
763+
["scheme"]=>
764+
string(4) "http"
765+
["host"]=>
766+
string(4) "host"
767+
["user"]=>
768+
string(4) "user"
769+
["pass"]=>
770+
string(5) "@pass"
771+
["path"]=>
772+
string(5) "/path"
773+
["query"]=>
774+
string(14) "argument?value"
775+
["fragment"]=>
776+
string(3) "etc"
777+
}
748778
string(4) "http"
749779
string(11) "www.php.net"
750780
int(80)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Bug #73192: parse_url return wrong hostname
3+
--FILE--
4+
<?php
5+
6+
var_dump(parse_url("http://example.com:80#@google.com/"));
7+
var_dump(parse_url("http://example.com:80?@google.com/"));
8+
9+
?>
10+
--EXPECT--
11+
array(4) {
12+
["scheme"]=>
13+
string(4) "http"
14+
["host"]=>
15+
string(11) "example.com"
16+
["port"]=>
17+
int(80)
18+
["fragment"]=>
19+
string(12) "@google.com/"
20+
}
21+
array(4) {
22+
["scheme"]=>
23+
string(4) "http"
24+
["host"]=>
25+
string(11) "example.com"
26+
["port"]=>
27+
int(80)
28+
["query"]=>
29+
string(12) "@google.com/"
30+
}

ext/standard/tests/url/parse_url_basic_001.phpt

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,23 @@ echo "Done";
507507
string(16) "some_page_ref123"
508508
}
509509

510+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(7) {
511+
["scheme"]=>
512+
string(4) "http"
513+
["host"]=>
514+
string(11) "www.php.net"
515+
["port"]=>
516+
int(80)
517+
["user"]=>
518+
string(14) "secret@hideout"
519+
["path"]=>
520+
string(10) "/index.php"
521+
["query"]=>
522+
string(31) "test=1&test2=char&test3=mixesCI"
523+
["fragment"]=>
524+
string(16) "some_page_ref123"
525+
}
526+
510527
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: array(8) {
511528
["scheme"]=>
512529
string(4) "http"
@@ -689,6 +706,23 @@ echo "Done";
689706
string(7) "9130731"
690707
}
691708

709+
--> http://user:@pass@host/path?argument?value#etc: array(7) {
710+
["scheme"]=>
711+
string(4) "http"
712+
["host"]=>
713+
string(4) "host"
714+
["user"]=>
715+
string(4) "user"
716+
["pass"]=>
717+
string(5) "@pass"
718+
["path"]=>
719+
string(5) "/path"
720+
["query"]=>
721+
string(14) "argument?value"
722+
["fragment"]=>
723+
string(3) "etc"
724+
}
725+
692726
--> http://10.10.10.10/:80: array(3) {
693727
["scheme"]=>
694728
string(4) "http"
@@ -744,25 +778,9 @@ echo "Done";
744778
int(6)
745779
}
746780

747-
--> http://?:/: array(3) {
748-
["scheme"]=>
749-
string(4) "http"
750-
["host"]=>
751-
string(1) "?"
752-
["path"]=>
753-
string(1) "/"
754-
}
781+
--> http://?:/: bool(false)
755782

756-
--> http://@?:/: array(4) {
757-
["scheme"]=>
758-
string(4) "http"
759-
["host"]=>
760-
string(1) "?"
761-
["user"]=>
762-
string(0) ""
763-
["path"]=>
764-
string(1) "/"
765-
}
783+
--> http://@?:/: bool(false)
766784

767785
--> file:///:: array(2) {
768786
["scheme"]=>
@@ -864,10 +882,4 @@ echo "Done";
864882
--> http://blah.com:123456: bool(false)
865883

866884
--> http://blah.com:abcdef: bool(false)
867-
868-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123: bool(false)
869-
870-
--> http://user:@pass@host/path?argument?value#etc: bool(false)
871-
872-
--> http://foo.com\@bar.com: bool(false)
873885
Done

ext/standard/tests/url/parse_url_basic_002.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ echo "Done";
6969
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
7070
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
7171
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
72+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
7273
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(4) "http"
7374
--> nntp://news.php.net : string(4) "nntp"
7475
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(3) "ftp"
@@ -89,6 +90,7 @@ echo "Done";
8990
--> scheme: : string(6) "scheme"
9091
--> foo+bar://baz@bang/bla : string(7) "foo+bar"
9192
--> gg:9130731 : string(2) "gg"
93+
--> http://user:@pass@host/path?argument?value#etc : string(4) "http"
9294
--> http://10.10.10.10/:80 : string(4) "http"
9395
--> http://x:? : string(4) "http"
9496
--> x:blah.com : string(1) "x"
@@ -97,8 +99,8 @@ echo "Done";
9799
--> http://::? : string(4) "http"
98100
--> http://::# : string(4) "http"
99101
--> x://::6.5 : string(1) "x"
100-
--> http://?:/ : string(4) "http"
101-
--> http://@?:/ : string(4) "http"
102+
--> http://?:/ : bool(false)
103+
--> http://@?:/ : bool(false)
102104
--> file:///: : string(4) "file"
103105
--> file:///a:/ : string(4) "file"
104106
--> file:///ab:/ : string(4) "file"
@@ -124,7 +126,4 @@ echo "Done";
124126
--> http://:? : bool(false)
125127
--> http://blah.com:123456 : bool(false)
126128
--> http://blah.com:abcdef : bool(false)
127-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
128-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
129-
--> http://foo.com\@bar.com : bool(false)
130129
Done

ext/standard/tests/url/parse_url_basic_003.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ echo "Done";
6868
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
6969
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
7070
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
71+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
7172
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(11) "www.php.net"
7273
--> nntp://news.php.net : string(12) "news.php.net"
7374
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(11) "ftp.gnu.org"
@@ -88,6 +89,7 @@ echo "Done";
8889
--> scheme: : NULL
8990
--> foo+bar://baz@bang/bla : string(4) "bang"
9091
--> gg:9130731 : NULL
92+
--> http://user:@pass@host/path?argument?value#etc : string(4) "host"
9193
--> http://10.10.10.10/:80 : string(11) "10.10.10.10"
9294
--> http://x:? : string(1) "x"
9395
--> x:blah.com : NULL
@@ -96,8 +98,8 @@ echo "Done";
9698
--> http://::? : string(1) ":"
9799
--> http://::# : string(1) ":"
98100
--> x://::6.5 : string(1) ":"
99-
--> http://?:/ : string(1) "?"
100-
--> http://@?:/ : string(1) "?"
101+
--> http://?:/ : bool(false)
102+
--> http://@?:/ : bool(false)
101103
--> file:///: : NULL
102104
--> file:///a:/ : NULL
103105
--> file:///ab:/ : NULL
@@ -123,7 +125,4 @@ echo "Done";
123125
--> http://:? : bool(false)
124126
--> http://blah.com:123456 : bool(false)
125127
--> http://blah.com:abcdef : bool(false)
126-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
127-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
128-
--> http://foo.com\@bar.com : bool(false)
129128
Done

ext/standard/tests/url/parse_url_basic_004.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ echo "Done";
6868
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
6969
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
7070
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
71+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
7172
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : int(80)
7273
--> nntp://news.php.net : NULL
7374
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
@@ -88,6 +89,7 @@ echo "Done";
8889
--> scheme: : NULL
8990
--> foo+bar://baz@bang/bla : NULL
9091
--> gg:9130731 : NULL
92+
--> http://user:@pass@host/path?argument?value#etc : NULL
9193
--> http://10.10.10.10/:80 : NULL
9294
--> http://x:? : NULL
9395
--> x:blah.com : NULL
@@ -96,8 +98,8 @@ echo "Done";
9698
--> http://::? : NULL
9799
--> http://::# : NULL
98100
--> x://::6.5 : int(6)
99-
--> http://?:/ : NULL
100-
--> http://@?:/ : NULL
101+
--> http://?:/ : bool(false)
102+
--> http://@?:/ : bool(false)
101103
--> file:///: : NULL
102104
--> file:///a:/ : NULL
103105
--> file:///ab:/ : NULL
@@ -123,7 +125,4 @@ echo "Done";
123125
--> http://:? : bool(false)
124126
--> http://blah.com:123456 : bool(false)
125127
--> http://blah.com:abcdef : bool(false)
126-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
127-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
128-
--> http://foo.com\@bar.com : bool(false)
129128
Done

ext/standard/tests/url/parse_url_basic_005.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ echo "Done";
6868
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
6969
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
7070
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
71+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(14) "secret@hideout"
7172
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(6) "secret"
7273
--> nntp://news.php.net : NULL
7374
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
@@ -88,6 +89,7 @@ echo "Done";
8889
--> scheme: : NULL
8990
--> foo+bar://baz@bang/bla : string(3) "baz"
9091
--> gg:9130731 : NULL
92+
--> http://user:@pass@host/path?argument?value#etc : string(4) "user"
9193
--> http://10.10.10.10/:80 : NULL
9294
--> http://x:? : NULL
9395
--> x:blah.com : NULL
@@ -96,8 +98,8 @@ echo "Done";
9698
--> http://::? : NULL
9799
--> http://::# : NULL
98100
--> x://::6.5 : NULL
99-
--> http://?:/ : NULL
100-
--> http://@?:/ : string(0) ""
101+
--> http://?:/ : bool(false)
102+
--> http://@?:/ : bool(false)
101103
--> file:///: : NULL
102104
--> file:///a:/ : NULL
103105
--> file:///ab:/ : NULL
@@ -123,7 +125,4 @@ echo "Done";
123125
--> http://:? : bool(false)
124126
--> http://blah.com:123456 : bool(false)
125127
--> http://blah.com:abcdef : bool(false)
126-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
127-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
128-
--> http://foo.com\@bar.com : bool(false)
129128
Done

ext/standard/tests/url/parse_url_basic_006.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ echo "Done";
6868
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(0) ""
6969
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
7070
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hideout"
71+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : NULL
7172
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(7) "hid:out"
7273
--> nntp://news.php.net : NULL
7374
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : NULL
@@ -88,6 +89,7 @@ echo "Done";
8889
--> scheme: : NULL
8990
--> foo+bar://baz@bang/bla : NULL
9091
--> gg:9130731 : NULL
92+
--> http://user:@pass@host/path?argument?value#etc : string(5) "@pass"
9193
--> http://10.10.10.10/:80 : NULL
9294
--> http://x:? : NULL
9395
--> x:blah.com : NULL
@@ -96,8 +98,8 @@ echo "Done";
9698
--> http://::? : NULL
9799
--> http://::# : NULL
98100
--> x://::6.5 : NULL
99-
--> http://?:/ : NULL
100-
--> http://@?:/ : NULL
101+
--> http://?:/ : bool(false)
102+
--> http://@?:/ : bool(false)
101103
--> file:///: : NULL
102104
--> file:///a:/ : NULL
103105
--> file:///ab:/ : NULL
@@ -123,7 +125,4 @@ echo "Done";
123125
--> http://:? : bool(false)
124126
--> http://blah.com:123456 : bool(false)
125127
--> http://blah.com:abcdef : bool(false)
126-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
127-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
128-
--> http://foo.com\@bar.com : bool(false)
129128
Done

ext/standard/tests/url/parse_url_basic_007.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ echo "Done";
6868
--> http://secret:@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
6969
--> http://:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
7070
--> http://secret:hideout@www.php.net/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
71+
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
7172
--> http://secret:hid:out@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : string(10) "/index.php"
7273
--> nntp://news.php.net : NULL
7374
--> ftp://ftp.gnu.org/gnu/glic/glibc.tar.gz : string(22) "/gnu/glic/glibc.tar.gz"
@@ -88,6 +89,7 @@ echo "Done";
8889
--> scheme: : NULL
8990
--> foo+bar://baz@bang/bla : string(4) "/bla"
9091
--> gg:9130731 : string(7) "9130731"
92+
--> http://user:@pass@host/path?argument?value#etc : string(5) "/path"
9193
--> http://10.10.10.10/:80 : string(4) "/:80"
9294
--> http://x:? : NULL
9395
--> x:blah.com : string(8) "blah.com"
@@ -96,8 +98,8 @@ echo "Done";
9698
--> http://::? : NULL
9799
--> http://::# : NULL
98100
--> x://::6.5 : NULL
99-
--> http://?:/ : string(1) "/"
100-
--> http://@?:/ : string(1) "/"
101+
--> http://?:/ : bool(false)
102+
--> http://@?:/ : bool(false)
101103
--> file:///: : string(2) "/:"
102104
--> file:///a:/ : string(3) "a:/"
103105
--> file:///ab:/ : string(5) "/ab:/"
@@ -123,7 +125,4 @@ echo "Done";
123125
--> http://:? : bool(false)
124126
--> http://blah.com:123456 : bool(false)
125127
--> http://blah.com:abcdef : bool(false)
126-
--> http://secret@hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123 : bool(false)
127-
--> http://user:@pass@host/path?argument?value#etc : bool(false)
128-
--> http://foo.com\@bar.com : bool(false)
129128
Done

0 commit comments

Comments
 (0)