Commit f12f1b4a1dd for php.net
commit f12f1b4a1dd1006382bc290782a47eff13621cac
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Thu Jul 30 18:05:42 2026 +0700
ext/mysqli: applied fixers to improve test robustness (#22929)
diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt
index 47642087acb..fdfc37d862b 100644
--- a/ext/mysqli/tests/bug36802.phpt
+++ b/ext/mysqli/tests/bug36802.phpt
@@ -18,7 +18,7 @@ function __construct()
try {
$mysql->set_charset('utf8');
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
} else {
$x[0] = false;
@@ -27,7 +27,7 @@ function __construct()
try {
$mysql->query("SELECT 'foo' FROM DUAL");
} catch (Error $exception) {
- echo $exception->getMessage() . "\n";
+ echo $exception::class, ': ', $exception->getMessage(), "\n";
}
/* following operations should work */
@@ -39,8 +39,8 @@ function __construct()
var_dump($x);
?>
--EXPECT--
-mysqli object is not fully initialized
-mysqli object is not fully initialized
+Error: mysqli object is not fully initialized
+Error: mysqli object is not fully initialized
array(2) {
[1]=>
string(0) ""
diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt
index 8666795bd87..9d2585b2fce 100644
--- a/ext/mysqli/tests/bug62885.phpt
+++ b/ext/mysqli/tests/bug62885.phpt
@@ -13,19 +13,19 @@
try {
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$test2 = array();
try {
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
} catch (\ValueError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
echo "okey";
?>
--EXPECTF--
-No stream arrays were passed
+ValueError: No stream arrays were passed
Warning: mysqli_poll(): No stream arrays were passed in %s on line %d
okey
diff --git a/ext/mysqli/tests/gh17900.phpt b/ext/mysqli/tests/gh17900.phpt
index ed099fa7e85..90aa3d7edfe 100644
--- a/ext/mysqli/tests/gh17900.phpt
+++ b/ext/mysqli/tests/gh17900.phpt
@@ -9,8 +9,8 @@
try {
$mysqli->__construct('doesnotexist');
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot call constructor twice
+Error: Cannot call constructor twice
diff --git a/ext/mysqli/tests/ghsa-h35g-vwh6-m678-auth-message.phpt b/ext/mysqli/tests/ghsa-h35g-vwh6-m678-auth-message.phpt
index 666f47f4199..84c38dd862d 100644
--- a/ext/mysqli/tests/ghsa-h35g-vwh6-m678-auth-message.phpt
+++ b/ext/mysqli/tests/ghsa-h35g-vwh6-m678-auth-message.phpt
@@ -18,7 +18,7 @@
$info = mysqli_info($conn);
var_dump($info);
} catch (Exception $e) {
- echo $e->getMessage() . PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
$process->terminate();
@@ -33,5 +33,5 @@
[*] Sending - Malicious OK Auth Response [Extract heap through buffer over-read]: 0900000200000002000000fcff
Warning: mysqli::__construct(): OK packet message length is past the packet size in %s on line %d
-Unknown error while trying to connect via tcp://127.0.0.1:%d
+mysqli_sql_exception: Unknown error while trying to connect via tcp://127.0.0.1:%d
done!
diff --git a/ext/mysqli/tests/mysqli_driver/write_property.phpt b/ext/mysqli/tests/mysqli_driver/write_property.phpt
index 456dd40c81d..7bb41440b39 100644
--- a/ext/mysqli/tests/mysqli_driver/write_property.phpt
+++ b/ext/mysqli/tests/mysqli_driver/write_property.phpt
@@ -10,7 +10,7 @@
/* Read-only property */
$driver->client_info = 'test';
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$driver->report_mode = "1";
@@ -18,11 +18,11 @@
try {
$driver->report_mode = [];
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot write read-only property mysqli_driver::$client_info
+Error: Cannot write read-only property mysqli_driver::$client_info
int(1)
-Cannot assign array to property mysqli_driver::$report_mode of type int
+TypeError: Cannot assign array to property mysqli_driver::$report_mode of type int
diff --git a/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt b/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt
index 41645ff61c2..996048ac1f3 100644
--- a/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt
+++ b/ext/mysqli/tests/mysqli_driver/write_property_strict.phpt
@@ -12,16 +12,16 @@
/* Read-only property */
$driver->client_info = 42;
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$driver->report_mode = "1";
} catch (Error $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Cannot write read-only property mysqli_driver::$client_info
-Cannot assign string to property mysqli_driver::$report_mode of type int
+Error: Cannot write read-only property mysqli_driver::$client_info
+TypeError: Cannot assign string to property mysqli_driver::$report_mode of type int
diff --git a/ext/mysqli/tests/mysqli_driver_unclonable.phpt b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
index 7041a024f67..94065a1379d 100644
--- a/ext/mysqli/tests/mysqli_driver_unclonable.phpt
+++ b/ext/mysqli/tests/mysqli_driver_unclonable.phpt
@@ -9,7 +9,7 @@
$driver = new mysqli_driver;
$driver_clone = clone $driver;
} catch (Throwable $e) {
- echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>