Commit ff7ef3c858f for php.net
commit ff7ef3c858fc54f8b62c1d274ce638523e202f09
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Tue Aug 11 03:24:29 2026 +0700
ext/standard: improved tests (#23184)
diff --git a/Zend/tests/named_params/internal_variadics.phpt b/Zend/tests/named_params/internal_variadics.phpt
index 8ec11ac2c34..ac5b629ccaa 100644
--- a/Zend/tests/named_params/internal_variadics.phpt
+++ b/Zend/tests/named_params/internal_variadics.phpt
@@ -6,13 +6,13 @@
try {
array_merge([1, 2], a: [3, 4]);
} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
array_diff_key([1, 2], [3, 4], a: [5, 6]);
} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump(array_intersect(array: [1, 2]) === [1, 2]);
@@ -20,19 +20,19 @@
try {
array_intersect([1, 2], arrays: [2]);
} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$array = [1, 2];
array_push($array, ...['values' => 3]);
} catch (ArgumentCountError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Internal function array_merge() does not accept named variadic arguments
-Internal function array_diff_key() does not accept named variadic arguments
+ArgumentCountError: Internal function array_merge() does not accept named variadic arguments
+ArgumentCountError: Internal function array_diff_key() does not accept named variadic arguments
bool(true)
-Internal function array_intersect() does not accept named variadic arguments
-Internal function array_push() does not accept named variadic arguments
+ArgumentCountError: Internal function array_intersect() does not accept named variadic arguments
+ArgumentCountError: Internal function array_push() does not accept named variadic arguments
diff --git a/ext/standard/tests/array/array_intersect_empty.phpt b/ext/standard/tests/array/array_intersect_empty.phpt
index 1bf527a4269..ab5ae218b7c 100644
--- a/ext/standard/tests/array/array_intersect_empty.phpt
+++ b/ext/standard/tests/array/array_intersect_empty.phpt
@@ -36,7 +36,7 @@ public function __toString(): string {
try {
array_intersect([], [], new stdClass());
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
@@ -52,4 +52,4 @@ public function __toString(): string {
[0]=>
int(10)
}
-array_intersect(): Argument #3 must be of type array, stdClass given
+TypeError: array_intersect(): Argument #3 must be of type array, stdClass given
diff --git a/ext/standard/tests/array/array_intersect_side_effects.phpt b/ext/standard/tests/array/array_intersect_side_effects.phpt
index 00cacb9b4a3..6c2a2451fdc 100644
--- a/ext/standard/tests/array/array_intersect_side_effects.phpt
+++ b/ext/standard/tests/array/array_intersect_side_effects.phpt
@@ -47,7 +47,7 @@ function temporary_argument(): array {
try {
array_intersect([[1], [2]], ['Array'], new stdClass());
} catch (TypeError $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
restore_error_handler();
@@ -67,4 +67,4 @@ function temporary_argument(): array {
[1]=>
string(4) "keep"
}
-array_intersect(): Argument #3 must be of type array, stdClass given
+TypeError: array_intersect(): Argument #3 must be of type array, stdClass given
diff --git a/ext/standard/tests/array/array_intersect_values.phpt b/ext/standard/tests/array/array_intersect_values.phpt
index caac782346b..53234e103cb 100644
--- a/ext/standard/tests/array/array_intersect_values.phpt
+++ b/ext/standard/tests/array/array_intersect_values.phpt
@@ -67,13 +67,13 @@ public function __toString(): string { throw new RuntimeException('conversion fa
try {
array_intersect(['value'], [new ThrowingStringableValue(), 'value']);
} catch (RuntimeException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
array_intersect([''], [new stdClass()]);
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
set_error_handler(static function (int $code, string $message): never {
@@ -82,7 +82,7 @@ public function __toString(): string { throw new RuntimeException('conversion fa
try {
array_intersect([[1]], [[2]]);
} catch (ErrorException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
} finally {
restore_error_handler();
}
@@ -98,6 +98,6 @@ public function __toString(): string { throw new RuntimeException('conversion fa
bool(true)
null,false,true,zero-float,float,resource,object
bool(true)
-conversion failed
-Object of class stdClass could not be converted to string
-Array to string conversion
+RuntimeException: conversion failed
+Error: Object of class stdClass could not be converted to string
+ErrorException: Array to string conversion