mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Reorganize ext/uri tests - parsing (#20340)
This commit is contained in:
14
ext/uri/tests/rfc3986/parsing/basic_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/basic_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - multibyte character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("🐘");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/basic_error_null_byte1.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/basic_error_null_byte1.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - URI contains null byte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://exam\0ple.com");
|
||||
} catch (ValueError $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ValueError: Uri\Rfc3986\Uri::__construct(): Argument #1 ($uri) must not contain any null bytes
|
||||
14
ext/uri/tests/rfc3986/parsing/basic_error_null_byte2.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/basic_error_null_byte2.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - URI contains null byte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
Uri\Rfc3986\Uri::parse("https://exam\0ple.com");
|
||||
} catch (ValueError $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ValueError: Uri\Rfc3986\Uri::parse(): Argument #1 ($uri) must not contain any null bytes
|
||||
33
ext/uri/tests/rfc3986/parsing/basic_success_all.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/basic_success_all.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - all components
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://user:info@example.com:443/foo/bar?abc=123&def=ghi#hashmark");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(4) "info"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
int(443)
|
||||
["path"]=>
|
||||
string(8) "/foo/bar"
|
||||
["query"]=>
|
||||
string(15) "abc=123&def=ghi"
|
||||
["fragment"]=>
|
||||
string(8) "hashmark"
|
||||
}
|
||||
string(66) "https://user:info@example.com:443/foo/bar?abc=123&def=ghi#hashmark"
|
||||
string(66) "https://user:info@example.com:443/foo/bar?abc=123&def=ghi#hashmark"
|
||||
33
ext/uri/tests/rfc3986/parsing/basic_sucess_email.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/basic_sucess_email.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - mailto email
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("mailto:user@example.com");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(6) "mailto"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(16) "user@example.com"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(23) "mailto:user@example.com"
|
||||
string(23) "mailto:user@example.com"
|
||||
33
ext/uri/tests/rfc3986/parsing/basic_sucess_empty.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/basic_sucess_empty.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - empty string
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
33
ext/uri/tests/rfc3986/parsing/basic_sucess_file.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/basic_sucess_file.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - file
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("file:///E:/Documents%20and%20Settings");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "file"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(30) "/E:/Documents%20and%20Settings"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(37) "file:///E:/Documents%20and%20Settings"
|
||||
string(37) "file:///E:/Documents%20and%20Settings"
|
||||
33
ext/uri/tests/rfc3986/parsing/basic_sucess_urn.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/basic_sucess_urn.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - basic - URN
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(3) "urn"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(41) "uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(45) "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"
|
||||
string(45) "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"
|
||||
14
ext/uri/tests/rfc3986/parsing/host_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/host_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - multibyte character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://exḁmple.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/host_error_reserved.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/host_error_reserved.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - reserved character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://ex[a]mple.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_empty1.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_empty1.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(8) "https://"
|
||||
string(8) "https://"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_empty2.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_empty2.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://user:pass@");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(4) "pass"
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(18) "https://user:pass@"
|
||||
string(18) "https://user:pass@"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_empty3.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_empty3.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("//");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(2) "//"
|
||||
string(2) "//"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_empty4.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_empty4.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("///");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(3) "///"
|
||||
string(3) "///"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_ipv4.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_ipv4.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - IPv4
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://192.168.0.1");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "192.168.0.1"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(19) "https://192.168.0.1"
|
||||
string(19) "https://192.168.0.1"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_ipv4_wrong.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_ipv4_wrong.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - wrong IPv4 format
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://192.168");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(7) "192.168"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(15) "https://192.168"
|
||||
string(15) "https://192.168"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_ipv6.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_ipv6.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - IPv6
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://[2001:0db8:3333:4444:5555:6666:7777:8888]");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(41) "[2001:0db8:3333:4444:5555:6666:7777:8888]"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(49) "https://[2001:0db8:3333:4444:5555:6666:7777:8888]"
|
||||
string(49) "https://[2001:0db8:3333:4444:5555:6666:7777:8888]"
|
||||
33
ext/uri/tests/rfc3986/parsing/host_success_ipvfuture.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/host_success_ipvfuture.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - host - IPvFuture
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https://[v7.host]");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(9) "[v7.host]"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(17) "https://[v7.host]"
|
||||
string(17) "https://[v7.host]"
|
||||
14
ext/uri/tests/rfc3986/parsing/path_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/path_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - multibyte character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://example.com/fȎȎ");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/path_error_reserved.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/path_error_reserved.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - reserved character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://example.com/fo[o/ba]r/");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("foo");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(3) "foo"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(3) "foo"
|
||||
string(3) "foo"
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("/foo");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(4) "/foo"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(4) "/foo"
|
||||
string(4) "/foo"
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("?query#fragment");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
NULL
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
string(5) "query"
|
||||
["fragment"]=>
|
||||
string(8) "fragment"
|
||||
}
|
||||
string(15) "?query#fragment"
|
||||
string(15) "?query#fragment"
|
||||
33
ext/uri/tests/rfc3986/parsing/path_success_slash_only.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/path_success_slash_only.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - path - slash only
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = new Uri\Rfc3986\Uri("https://example.com/");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "https://example.com/"
|
||||
string(20) "https://example.com/"
|
||||
14
ext/uri/tests/rfc3986/parsing/port_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/port_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - multibyte character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://example.com:Ȏ");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/port_error_negative.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/port_error_negative.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - negative value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
var_dump(new Uri\Rfc3986\Uri("http://example.com:-1"));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - percent encoded character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("https://example.com:%30");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - user info component is in wrong place
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
var_dump(new Uri\Rfc3986\Uri("https://example.com:8080@username:password"));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
33
ext/uri/tests/rfc3986/parsing/port_success_empty.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/port_success_empty.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("http://example.com:");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(19) "http://example.com:"
|
||||
string(19) "http://example.com:"
|
||||
33
ext/uri/tests/rfc3986/parsing/port_success_zero.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/port_success_zero.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - port - zero
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("http://example.com:0");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
int(0)
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "http://example.com:0"
|
||||
string(20) "http://example.com:0"
|
||||
14
ext/uri/tests/rfc3986/parsing/scheme_error_empty.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/scheme_error_empty.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/scheme_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/scheme_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - multibyte characters
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("ƕŢŢƤƨ://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - percent encoded character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("http%2F://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/scheme_error_reserved.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/scheme_error_reserved.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - reserved character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("http&://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
33
ext/uri/tests/rfc3986/parsing/scheme_success_empty_host.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/scheme_success_empty_host.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - empty host
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("https:example.com");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(11) "example.com"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(17) "https:example.com"
|
||||
string(17) "https:example.com"
|
||||
33
ext/uri/tests/rfc3986/parsing/scheme_success_iana.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/scheme_success_iana.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - IANA scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("chrome-extension://example.com");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(16) "chrome-extension"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(30) "chrome-extension://example.com"
|
||||
string(30) "chrome-extension://example.com"
|
||||
33
ext/uri/tests/rfc3986/parsing/scheme_success_only.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/scheme_success_only.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - only scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("http:");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(5) "http:"
|
||||
string(5) "http:"
|
||||
33
ext/uri/tests/rfc3986/parsing/scheme_success_only2.phpt
Normal file
33
ext/uri/tests/rfc3986/parsing/scheme_success_only2.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - scheme - only scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$uri = Uri\Rfc3986\Uri::parse("http:/");
|
||||
|
||||
var_dump($uri);
|
||||
var_dump($uri->toRawString());
|
||||
var_dump($uri->toString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\Rfc3986\Uri)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(6) "http:/"
|
||||
string(6) "http:/"
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - userinfo - extended ASCII character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("http://úzör@example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/userinfo_error_multibyte.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/userinfo_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - userinfo - multibyte character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("http://usĕr:pąss@example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/rfc3986/parsing/userinfo_error_reserved.phpt
Normal file
14
ext/uri/tests/rfc3986/parsing/userinfo_error_reserved.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\Rfc3986\Uri parsing - userinfo - reserved character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\Rfc3986\Uri("http://us[er]:pass@example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\InvalidUriException: The specified URI is malformed
|
||||
14
ext/uri/tests/whatwg/parsing/basic_error_empty.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/basic_error_empty.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - empty string
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/basic_error_null_byte1.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/basic_error_null_byte1.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - URL contains null byte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://exam\0ple.com");
|
||||
} catch (ValueError $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ValueError: Uri\WhatWg\Url::__construct(): Argument #1 ($uri) must not contain any null bytes
|
||||
14
ext/uri/tests/whatwg/parsing/basic_error_null_byte2.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/basic_error_null_byte2.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - URL contains null byte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
Uri\WhatWg\Url::parse("https://exam\0ple.com");
|
||||
} catch (ValueError $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
ValueError: Uri\WhatWg\Url::parse(): Argument #1 ($uri) must not contain any null bytes
|
||||
31
ext/uri/tests/whatwg/parsing/basic_success_all.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/basic_success_all.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - all components
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://user:info@example.com:443/foo/bar?abc=123&def=ghi#hashmark");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(4) "info"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(8) "/foo/bar"
|
||||
["query"]=>
|
||||
string(15) "abc=123&def=ghi"
|
||||
["fragment"]=>
|
||||
string(8) "hashmark"
|
||||
}
|
||||
string(62) "https://user:info@example.com/foo/bar?abc=123&def=ghi#hashmark"
|
||||
31
ext/uri/tests/whatwg/parsing/basic_sucess_email.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/basic_sucess_email.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - mailto email
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("mailto:user@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(6) "mailto"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(16) "user@example.com"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(23) "mailto:user@example.com"
|
||||
31
ext/uri/tests/whatwg/parsing/basic_sucess_file.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/basic_sucess_file.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - file
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("file:///E:/Documents%20and%20Settings");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "file"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(0) ""
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(30) "/E:/Documents%20and%20Settings"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(37) "file:///E:/Documents%20and%20Settings"
|
||||
31
ext/uri/tests/whatwg/parsing/basic_sucess_urn.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/basic_sucess_urn.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - basic - URN
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(3) "urn"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
NULL
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(41) "uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(45) "urn:uuid:6e8bc430-9c3a-11d9-9669-0800200c9a66"
|
||||
14
ext/uri/tests/whatwg/parsing/host_error_Invalid.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_error_Invalid.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - invalid code point
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://ex[a]mple.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (DomainInvalidCodePoint)
|
||||
14
ext/uri/tests/whatwg/parsing/host_error_empty1.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_error_empty1.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (HostMissing)
|
||||
14
ext/uri/tests/whatwg/parsing/host_error_empty2.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_error_empty2.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://user:pass@");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed
|
||||
14
ext/uri/tests/whatwg/parsing/host_error_empty3.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_error_empty3.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("/");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/host_error_ipvfuture.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_error_ipvfuture.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - IPvFuture
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://[v7.host]");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (Ipv6InvalidCodePoint)
|
||||
14
ext/uri/tests/whatwg/parsing/host_success_empty4.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/host_success_empty4.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("///");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
31
ext/uri/tests/whatwg/parsing/host_success_ipv4.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/host_success_ipv4.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - IPv4
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://192.168.0.1");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "192.168.0.1"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "https://192.168.0.1/"
|
||||
31
ext/uri/tests/whatwg/parsing/host_success_ipv4_wrong.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/host_success_ipv4_wrong.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - wrong IPv4 format
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://192.168");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "192.0.0.168"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "https://192.0.0.168/"
|
||||
31
ext/uri/tests/whatwg/parsing/host_success_ipv6.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/host_success_ipv6.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - IPv6
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://[2001:0db8:3333:4444:5555:6666:7777:8888]");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(40) "[2001:db8:3333:4444:5555:6666:7777:8888]"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(49) "https://[2001:db8:3333:4444:5555:6666:7777:8888]/"
|
||||
33
ext/uri/tests/whatwg/parsing/host_success_multibyte.phpt
Normal file
33
ext/uri/tests/whatwg/parsing/host_success_multibyte.phpt
Normal file
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - host - multibyte codepoint
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://exḁmple.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
var_dump($url->toUnicodeString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(19) "xn--exmple-xf7b.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(28) "https://xn--exmple-xf7b.com/"
|
||||
string(22) "https://exḁmple.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/password_success_empty.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/password_success_empty.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - password - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://user:@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(0) ""
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(25) "https://user@example.com/"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - password - extended ASCII character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("http://user:pásswörd@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(18) "p%C3%A1ssw%C3%B6rd"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(43) "http://user:p%C3%A1ssw%C3%B6rd@example.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/password_success_multibyte.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/password_success_multibyte.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - password - multibyte codepoint
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("http://user:pąss@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(9) "p%C4%85ss"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(34) "http://user:p%C4%85ss@example.com/"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - password - codepoint in percent-encode set
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("http://user:pa|s@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
string(4) "user"
|
||||
["password"]=>
|
||||
string(6) "pa%7Cs"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(31) "http://user:pa%7Cs@example.com/"
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("foo");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("/foo");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - relative reference
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("?query#fragment");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
31
ext/uri/tests/whatwg/parsing/path_success_multibyte.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/path_success_multibyte.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - multibyte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://example.com/fȎȎ");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(14) "/f%C8%8E%C8%8E"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(33) "https://example.com/f%C8%8E%C8%8E"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - codepoint in percent-encode set
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://example.com/foo\"/<bar>/^{baz}");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(28) "/foo%22/%3Cbar%3E/^%7Bbaz%7D"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(47) "https://example.com/foo%22/%3Cbar%3E/^%7Bbaz%7D"
|
||||
31
ext/uri/tests/whatwg/parsing/path_success_slash_only.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/path_success_slash_only.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - slash only
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://example.com/");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "https://example.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/path_success_special.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/path_success_special.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - path - special characters
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://example.com/fo[o/ba]r/baz=q@z,&");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(20) "/fo[o/ba]r/baz=q@z,&"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(39) "https://example.com/fo[o/ba]r/baz=q@z,&"
|
||||
14
ext/uri/tests/whatwg/parsing/port_error_multibyte.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/port_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - multibyte
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://example.com:Ȏ");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortInvalid)
|
||||
14
ext/uri/tests/whatwg/parsing/port_error_negative.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/port_error_negative.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - negative value
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("http://example.com:-1");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortInvalid)
|
||||
14
ext/uri/tests/whatwg/parsing/port_error_percent_encoded.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/port_error_percent_encoded.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - percent encoded character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("https://example.com:%30");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortInvalid)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - user info component is in wrong place
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
var_dump(new Uri\WhatWg\Url("https://example.com:8080@username:password"));
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (PortInvalid)
|
||||
31
ext/uri/tests/whatwg/parsing/port_success_empty.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/port_success_empty.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("http://example.com:");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(19) "http://example.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/port_success_zero.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/port_success_zero.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - port - zero
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("http://example.com:0");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
int(0)
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(21) "http://example.com:0/"
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_empty.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_empty.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_invalid.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_invalid.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - invalid character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("http&://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_multibyte.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_multibyte.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - multibyte codepoint
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("ƕŢŢƤƨ://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_only1.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_only1.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - only scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("http:");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (HostMissing)
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_only2.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_only2.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - only scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("http:/");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (HostMissing)
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - percent encoded character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("http%2F://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
14
ext/uri/tests/whatwg/parsing/scheme_error_special.phpt
Normal file
14
ext/uri/tests/whatwg/parsing/scheme_error_special.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - invalid character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
new Uri\WhatWg\Url("hÁttp://example.com");
|
||||
} catch (Throwable $e) {
|
||||
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Uri\WhatWg\InvalidUrlException: The specified URI is malformed (MissingSchemeNonRelativeUrl)
|
||||
31
ext/uri/tests/whatwg/parsing/scheme_success_iana.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/scheme_success_iana.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - IANA scheme
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("chrome-extension://example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(16) "chrome-extension"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(0) ""
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(30) "chrome-extension://example.com"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - scheme - without //
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https:example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
NULL
|
||||
["password"]=>
|
||||
NULL
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(20) "https://example.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/username_success_empty.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/username_success_empty.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - username - empty
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = Uri\WhatWg\Url::parse("https://:pass@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(0) ""
|
||||
["password"]=>
|
||||
string(4) "pass"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(26) "https://:pass@example.com/"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - username - extended ASCII character
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://úzör@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(14) "%C3%BAz%C3%B6r"
|
||||
["password"]=>
|
||||
string(0) ""
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(35) "https://%C3%BAz%C3%B6r@example.com/"
|
||||
31
ext/uri/tests/whatwg/parsing/username_success_multibyte.phpt
Normal file
31
ext/uri/tests/whatwg/parsing/username_success_multibyte.phpt
Normal file
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - username - multibyte codepoint
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("https://usĕr:pass@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(5) "https"
|
||||
["username"]=>
|
||||
string(9) "us%C4%95r"
|
||||
["password"]=>
|
||||
string(4) "pass"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(35) "https://us%C4%95r:pass@example.com/"
|
||||
@@ -0,0 +1,31 @@
|
||||
--TEST--
|
||||
Test Uri\WhatWg\Url parsing - username - codepoint in percent-encode set
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$url = new Uri\WhatWg\Url("http://us[er]:pass@example.com");
|
||||
|
||||
var_dump($url);
|
||||
var_dump($url->toAsciiString());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(Uri\WhatWg\Url)#%d (%d) {
|
||||
["scheme"]=>
|
||||
string(4) "http"
|
||||
["username"]=>
|
||||
string(10) "us%5Ber%5D"
|
||||
["password"]=>
|
||||
string(4) "pass"
|
||||
["host"]=>
|
||||
string(11) "example.com"
|
||||
["port"]=>
|
||||
NULL
|
||||
["path"]=>
|
||||
string(1) "/"
|
||||
["query"]=>
|
||||
NULL
|
||||
["fragment"]=>
|
||||
NULL
|
||||
}
|
||||
string(35) "http://us%5Ber%5D:pass@example.com/"
|
||||
Reference in New Issue
Block a user