[php-src] master: ext/session: applied fixers to improve test robustness (#23036)

NickSdot via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: Girgias
Date: 2026-08-06T17:25:21+01:00

Commit: https://github.com/php/php-src/commit/53e1292056986d6033cc1bedbc2a10cbe9f8ef94
Raw diff: https://github.com/php/php-src/commit/53e1292056986d6033cc1bedbc2a10cbe9f8ef94.diff

ext/session: applied fixers to improve test robustness (#23036)

Changed paths:
  M  ext/session/tests/bug73100.phpt
  M  ext/session/tests/session_create_id_invalid_prefix.phpt
  M  ext/session/tests/session_encode_error2.phpt
  M  ext/session/tests/session_gc_probability_ini.phpt
  M  ext/session/tests/session_name_variation_null_byte.phpt
  M  ext/session/tests/session_set_cookie_params_variation7.phpt
  M  ext/session/tests/session_start_error.phpt
  M  ext/session/tests/user_session_module/bug31454.phpt
  M  ext/session/tests/user_session_module/bug55688.phpt
  M  ext/session/tests/user_session_module/bug67972.phpt
  M  ext/session/tests/user_session_module/bug69111.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_class_012.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_error4.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_error5.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_type_error.phpt
  M  ext/session/tests/user_session_module/session_set_save_handler_type_error2.phpt
  M  ext/session/tests/user_session_module/sessionhandler_open_001.phpt


Diff:

diff --git a/ext/session/tests/bug73100.phpt b/ext/session/tests/bug73100.phpt
index fc9984428726..125849c06559 100644
--- a/ext/session/tests/bug73100.phpt
+++ b/ext/session/tests/bug73100.phpt
@@ -15,7 +15,7 @@ var_dump(session_destroy());
 try {
     session_module_name("user");
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 ===DONE===
@@ -24,5 +24,5 @@ bool(true)
 
 Warning: session_module_name(): Session save handler module cannot be changed when a session is active (started from %s on line %d) in %s on line %d
 bool(true)
-session_module_name(): Argument #1 ($module) must not be "user"
+ValueError: session_module_name(): Argument #1 ($module) must not be "user"
 ===DONE===
diff --git a/ext/session/tests/session_create_id_invalid_prefix.phpt b/ext/session/tests/session_create_id_invalid_prefix.phpt
index 7de7e8061f68..4d84944f5cfe 100644
--- a/ext/session/tests/session_create_id_invalid_prefix.phpt
+++ b/ext/session/tests/session_create_id_invalid_prefix.phpt
@@ -16,13 +16,13 @@ var_dump(session_create_id('%'));
 try {
     var_dump(session_create_id('ABTgdPs68S3M4HMaqKwj33TzqLMv5PHpWQxJbfpeogEhrJRY7o9f33pKLCmhf0tXCtoBkIu0yxXYCSHfJhPd2miPUW4MIpd91dnEiOwWDfaBnfdJZOwgvgmYLSfDGaebqmnCAoyuzlcq2j59nNRhccgJIkr9ytY3RwFTTXszpcjpx6mlJuG9GksKAhPsnnaEwSEb0eFyqvn80gYI2roKSjaFSmJxg0xgXuCF4csMo8DxiSvovho5QTKx5u7h8VyQL'));
 } catch (Throwable $e) {
-    echo $e::class . ': ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 try {
     var_dump(session_create_id("AB\0CD"));
 } catch (Throwable $e) {
-    echo $e::class . ': ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 ?>
diff --git a/ext/session/tests/session_encode_error2.phpt b/ext/session/tests/session_encode_error2.phpt
index 42f5c4dd6888..5bdc263f3679 100644
--- a/ext/session/tests/session_encode_error2.phpt
+++ b/ext/session/tests/session_encode_error2.phpt
@@ -34,7 +34,7 @@ foreach($inputs as $input) {
     try {
         $_SESSION[$input] = "Hello World!";
     } catch (Error $e) {
-        echo $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
     var_dump(session_encode());
     var_dump(session_destroy());
diff --git a/ext/session/tests/session_gc_probability_ini.phpt b/ext/session/tests/session_gc_probability_ini.phpt
index 6d6f7519ba41..5efd2ddc809e 100644
--- a/ext/session/tests/session_gc_probability_ini.phpt
+++ b/ext/session/tests/session_gc_probability_ini.phpt
@@ -36,7 +36,7 @@ try {
     session_start($gc_setting);
     session_write_close();
     } catch (Throwable $e) {
-        echo $e::class, ': '. $e->getMessage(), "\n";
+        echo $e::class, ': ', $e->getMessage(), "\n";
     }
 }
 ob_end_flush();
diff --git a/ext/session/tests/session_name_variation_null_byte.phpt b/ext/session/tests/session_name_variation_null_byte.phpt
index 84b6ccfb1e6b..86c67cb035ec 100644
--- a/ext/session/tests/session_name_variation_null_byte.phpt
+++ b/ext/session/tests/session_name_variation_null_byte.phpt
@@ -11,11 +11,11 @@ try {
     var_dump(session_name("AB\0CD"));
     var_dump(session_start());
 } catch (ValueError $e) {
-    echo $e->getMessage(). "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 echo "Done";
 ?>
 --EXPECT--
-session_name(): Argument #1 ($name) must not contain any null bytes
+ValueError: session_name(): Argument #1 ($name) must not contain any null bytes
 Done
diff --git a/ext/session/tests/session_set_cookie_params_variation7.phpt b/ext/session/tests/session_set_cookie_params_variation7.phpt
index 3780fc0222f1..4874192ae147 100644
--- a/ext/session/tests/session_set_cookie_params_variation7.phpt
+++ b/ext/session/tests/session_set_cookie_params_variation7.phpt
@@ -22,13 +22,13 @@ echo "*** Testing session_set_cookie_params() : array parameter variation ***\n"
 try {
     session_set_cookie_params([]);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_cookie_params(["unknown_key" => true, "secure_invalid" => true]);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 var_dump(ini_get("session.cookie_secure"));
@@ -46,7 +46,7 @@ var_dump(ini_get("session.cookie_path"));
 try {
     session_set_cookie_params(["path" => "newpath/"], "arg after options array");
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 var_dump(ini_get("session.cookie_path"));
@@ -56,12 +56,12 @@ ob_end_flush();
 ?>
 --EXPECTF--
 *** Testing session_set_cookie_params() : array parameter variation ***
-session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
+ValueError: session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
 
 Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "unknown_key" in %s on line %d
 
 Warning: session_set_cookie_params(): Argument #1 ($lifetime_or_options) contains an unrecognized key "secure_invalid" in %s on line %d
-session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
+ValueError: session_set_cookie_params(): Argument #1 ($lifetime_or_options) must contain at least 1 valid key
 string(1) "0"
 string(0) ""
 bool(true)
@@ -71,6 +71,6 @@ string(1) "0"
 bool(true)
 string(2) "42"
 string(1) "/"
-session_set_cookie_params(): Argument #2 ($path) must be null when argument #1 ($lifetime_or_options) is an array
+ValueError: session_set_cookie_params(): Argument #2 ($path) must be null when argument #1 ($lifetime_or_options) is an array
 string(1) "/"
 Done
diff --git a/ext/session/tests/session_start_error.phpt b/ext/session/tests/session_start_error.phpt
index f616b8d4e95d..05e09a2faf6a 100644
--- a/ext/session/tests/session_start_error.phpt
+++ b/ext/session/tests/session_start_error.phpt
@@ -12,7 +12,7 @@ ob_start();
 try {
     session_start(['option' => new stdClass()]);
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 $read_and_close = "false";
@@ -20,7 +20,7 @@ $read_and_close = "false";
 try {
     session_start([$read_and_close]);
 } catch (ValueError $exception) {
-    echo $exception::class, ': ', $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 var_dump(session_start(['option' => false]));
@@ -29,7 +29,7 @@ ob_end_flush();
 
 ?>
 --EXPECTF--
-session_start(): Option "option" must be of type string|int|bool, stdClass given
+TypeError: session_start(): Option "option" must be of type string|int|bool, stdClass given
 ValueError: session_start(): Argument #1 ($options) must be of type array with keys as string
 
 Warning: session_start(): Setting option "option" failed in %s on line %d
diff --git a/ext/session/tests/user_session_module/bug31454.phpt b/ext/session/tests/user_session_module/bug31454.phpt
index 09858be34bd2..2098c1a48fc5 100644
--- a/ext/session/tests/user_session_module/bug31454.phpt
+++ b/ext/session/tests/user_session_module/bug31454.phpt
@@ -15,12 +15,12 @@ try {
         array(&$arf, 'gc')
     );
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 echo "Done\n";
 ?>
 --EXPECTF--
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #1 ($open) must be a valid callback, first array member is not a valid class name or object
+TypeError: session_set_save_handler(): Argument #1 ($open) must be a valid callback, first array member is not a valid class name or object
 Done
diff --git a/ext/session/tests/user_session_module/bug55688.phpt b/ext/session/tests/user_session_module/bug55688.phpt
index b1fcec38228c..55047dc6b9c7 100644
--- a/ext/session/tests/user_session_module/bug55688.phpt
+++ b/ext/session/tests/user_session_module/bug55688.phpt
@@ -13,8 +13,8 @@ $x = new SessionHandler;
 try {
     $x->gc(1);
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Session is not active
+Error: Session is not active
diff --git a/ext/session/tests/user_session_module/bug67972.phpt b/ext/session/tests/user_session_module/bug67972.phpt
index a35b3ac08a26..5beea5bf15e3 100644
--- a/ext/session/tests/user_session_module/bug67972.phpt
+++ b/ext/session/tests/user_session_module/bug67972.phpt
@@ -8,9 +8,9 @@ session
 try {
     (new SessionHandler)->create_sid();
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-Session is not active
+Error: Session is not active
diff --git a/ext/session/tests/user_session_module/bug69111.phpt b/ext/session/tests/user_session_module/bug69111.phpt
index 395eb33900ed..c3d9a325da79 100644
--- a/ext/session/tests/user_session_module/bug69111.phpt
+++ b/ext/session/tests/user_session_module/bug69111.phpt
@@ -12,23 +12,23 @@ session_set_save_handler($sh);
 try {
     $sh->open('path', 'name');
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $sh->write("foo", "bar");
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $sh->read("");
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 ?>
 --EXPECT--
-Session is not active
-Session is not active
-Session is not active
+Error: Session is not active
+Error: Session is not active
+Error: Session is not active
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_class_012.phpt b/ext/session/tests/user_session_module/session_set_save_handler_class_012.phpt
index f96206efbb64..ee69e9f52a4e 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_class_012.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_class_012.phpt
@@ -35,7 +35,7 @@ session_set_save_handler($handler);
 try {
     var_dump(session_start());
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
@@ -43,7 +43,7 @@ var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i
 --EXPECTF--
 *** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
 Open:
-SessionHandler::open() expects exactly 2 arguments, 0 given
+ArgumentCountError: SessionHandler::open() expects exactly 2 arguments, 0 given
 
 Warning: Undefined global variable $_SESSION in %s on line %d
 string(0) ""
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_error4.phpt b/ext/session/tests/user_session_module/session_set_save_handler_error4.phpt
index 6e05c209a799..1cac1bd95bd4 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_error4.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_error4.phpt
@@ -14,37 +14,37 @@ function callback() { return true; }
 try {
     session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
@@ -58,19 +58,19 @@ ob_end_flush();
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name
+TypeError: session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name
+TypeError: session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name
+TypeError: session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name
+TypeError: session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name
+TypeError: session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
 
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_error5.phpt b/ext/session/tests/user_session_module/session_set_save_handler_error5.phpt
index 4fc02237ba77..a44647085c28 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_error5.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_error5.phpt
@@ -10,7 +10,7 @@ try {
     session_set_save_handler(new \SessionHandler(), true);
     session_start();
 } catch (Throwable $e) {
-    echo $e::class . ': ' . $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 echo "ok";
 ?>
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt b/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt
index b1f0d4b2c57d..f8417ec9766f 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_iface_002.phpt
@@ -73,7 +73,7 @@ var_dump($ret);
 try {
     $ret = session_set_save_handler($handler);
 } catch (TypeError $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 session_start();
@@ -83,7 +83,7 @@ session_start();
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
 bool(true)
-session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given
+TypeError: session_set_save_handler(): Argument #1 ($open) must be of type SessionHandlerInterface, MySession2 given
 good handler writing
 
 Deprecated: PHP Request Shutdown: Session callback must have a return value of type bool, int returned in Unknown on line 0
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_type_error.phpt b/ext/session/tests/user_session_module/session_set_save_handler_type_error.phpt
index 6d5fb1748cde..db17dc3320c0 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_type_error.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_type_error.phpt
@@ -15,28 +15,28 @@ try {
     $ret = session_set_save_handler($exceptionCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $ret = session_set_save_handler($deprecatedCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $ret = session_set_save_handler($validCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $ret = session_set_save_handler($validCallback, $deprecatedCallback, $exceptionCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 ob_end_flush();
@@ -44,7 +44,7 @@ ob_end_flush();
 ?>
 --EXPECTF--
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-Session callback must have a return value of type bool, array returned
+TypeError: Session callback must have a return value of type bool, array returned
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
 
@@ -53,7 +53,7 @@ Deprecated: session_start(): Session callback must have a return value of type b
 Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-Session callback must have a return value of type bool, array returned
+TypeError: Session callback must have a return value of type bool, array returned
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
 
diff --git a/ext/session/tests/user_session_module/session_set_save_handler_type_error2.phpt b/ext/session/tests/user_session_module/session_set_save_handler_type_error2.phpt
index 8c6b553f8111..b19471d4632d 100644
--- a/ext/session/tests/user_session_module/session_set_save_handler_type_error2.phpt
+++ b/ext/session/tests/user_session_module/session_set_save_handler_type_error2.phpt
@@ -15,13 +15,13 @@ try {
     $ret = session_set_save_handler($nullCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 try {
     $ret = session_set_save_handler($oneCallback, $validCallback, $validCallback, $validCallback, $validCallback, $validCallback);
     session_start();
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 ob_end_flush();
@@ -29,7 +29,7 @@ ob_end_flush();
 ?>
 --EXPECTF--
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-Session callback must have a return value of type bool, null returned
+TypeError: Session callback must have a return value of type bool, null returned
 
 Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d
-Session callback must have a return value of type bool, int returned
+TypeError: Session callback must have a return value of type bool, int returned
diff --git a/ext/session/tests/user_session_module/sessionhandler_open_001.phpt b/ext/session/tests/user_session_module/sessionhandler_open_001.phpt
index d3f0bf989622..5263fe88a0c2 100644
--- a/ext/session/tests/user_session_module/sessionhandler_open_001.phpt
+++ b/ext/session/tests/user_session_module/sessionhandler_open_001.phpt
@@ -11,33 +11,33 @@ $x = new SessionHandler;
 try {
     $x->open('','');
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $x->open('','');
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $x->open('','');
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 try {
     $x->open('','');
 } catch (Error $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }
 
 print "Done!\n";
 
 ?>
 --EXPECT--
-Session is not active
-Session is not active
-Session is not active
-Session is not active
+Error: Session is not active
+Error: Session is not active
+Error: Session is not active
+Error: Session is not active
 Done!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.