1
0
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:
  uri: Unify exception testing for modification tests (#20368)
This commit is contained in:
Tim Düsterhus
2025-11-02 22:44:34 +01:00
24 changed files with 72 additions and 72 deletions

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withFragment("#fragment");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified fragment is malformed
Uri\InvalidUriException: The specified fragment is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withFragment("ő");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified fragment is malformed
Uri\InvalidUriException: The specified fragment is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withHost("ex#mple.com");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed
Uri\InvalidUriException: The specified host is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withPath("/[foo]");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified path is malformed
Uri\InvalidUriException: The specified path is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withPath("/ő");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified path is malformed
Uri\InvalidUriException: The specified path is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withPath("foo");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified path is malformed
Uri\InvalidUriException: The specified path is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withPort(-1);
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified port is malformed
Uri\InvalidUriException: The specified port is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withQuery("#foo");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified query is malformed
Uri\InvalidUriException: The specified query is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withQuery("ő");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified query is malformed
Uri\InvalidUriException: The specified query is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withScheme("");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\InvalidUriException: The specified scheme is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withScheme("http%73");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\InvalidUriException: The specified scheme is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withScheme("https:");
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\InvalidUriException: The specified scheme is malformed

View File

@@ -9,10 +9,10 @@ $uri = Uri\Rfc3986\Uri::parse("https://example.com");
try {
$uri->withUserInfo("us/r:password"); // us/r:password
} catch (Uri\InvalidUriException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified userinfo is malformed
Uri\InvalidUriException: The specified userinfo is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withHost("");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed (HostMissing)
Uri\WhatWg\InvalidUrlException: The specified host is malformed (HostMissing)

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("foo://example.com");
try {
$url = $url->withHost("ex@mple.com");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed (HostInvalidCodePoint)
Uri\WhatWg\InvalidUrlException: The specified host is malformed (HostInvalidCodePoint)

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url = $url->withHost("ex@mple.com");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed (DomainInvalidCodePoint)
Uri\WhatWg\InvalidUrlException: The specified host is malformed (DomainInvalidCodePoint)

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url = $url->withHost("ex:mple.com");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed
Uri\WhatWg\InvalidUrlException: The specified host is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url = $url->withHost("ex:mple.com");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed
Uri\WhatWg\InvalidUrlException: The specified host is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url = $url->withHost(null);
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified host is malformed (HostMissing)
Uri\WhatWg\InvalidUrlException: The specified host is malformed (HostMissing)

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withPort(-1);
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified port is malformed
Uri\WhatWg\InvalidUrlException: The specified port is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withPort(65536);
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified port is malformed (PortOutOfRange)
Uri\WhatWg\InvalidUrlException: The specified port is malformed (PortOutOfRange)

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withScheme("");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\WhatWg\InvalidUrlException: The specified scheme is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withScheme("http%73");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\WhatWg\InvalidUrlException: The specified scheme is malformed

View File

@@ -9,10 +9,10 @@ $url = Uri\WhatWg\Url::parse("https://example.com");
try {
$url->withScheme("http?");
} catch (Uri\WhatWg\InvalidUrlException $e) {
echo $e->getMessage() . "\n";
} catch (Throwable $e) {
echo $e::class, ": ", $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
The specified scheme is malformed
Uri\WhatWg\InvalidUrlException: The specified scheme is malformed