Commit 59ad2092061 for php.net
commit 59ad20920610af2608efdbbe4176e8d8b0da73d3
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Sat Aug 8 01:29:50 2026 +0700
ext/pdo_sqlite: applied fixers to improve test robustness (#23032)
diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt
index a45d34a580e..611cc59c982 100644
--- a/ext/pdo_sqlite/tests/bug66033.phpt
+++ b/ext/pdo_sqlite/tests/bug66033.phpt
@@ -24,8 +24,8 @@ protected function __construct($dbh) {
try {
$pdoStatement = $pdo->query("select * from messages");
} catch (Exception $e) {
- var_dump($e->getMessage());
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-string(4) "Blah"
+Exception: Blah
diff --git a/ext/pdo_sqlite/tests/bug81227.phpt b/ext/pdo_sqlite/tests/bug81227.phpt
index b15818e8a13..8fc469ed36f 100644
--- a/ext/pdo_sqlite/tests/bug81227.phpt
+++ b/ext/pdo_sqlite/tests/bug81227.phpt
@@ -13,7 +13,7 @@
try {
$db->beginTransaction();
} catch (PDOException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$db->commit();
@@ -25,6 +25,6 @@
--EXPECT--
bool(false)
bool(true)
-There is already an active transaction
+PDOException: There is already an active transaction
bool(false)
bool(true)
diff --git a/ext/pdo_sqlite/tests/bug_44159_sqlite_version.phpt b/ext/pdo_sqlite/tests/bug_44159_sqlite_version.phpt
index 69cd0897e38..d22f7c7a85b 100644
--- a/ext/pdo_sqlite/tests/bug_44159_sqlite_version.phpt
+++ b/ext/pdo_sqlite/tests/bug_44159_sqlite_version.phpt
@@ -10,19 +10,19 @@
try {
var_dump($pdo->setAttribute(PDO::NULL_TO_STRING, NULL));
} catch (\TypeError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($pdo->setAttribute(PDO::NULL_TO_STRING, 1));
try {
var_dump($pdo->setAttribute(PDO::NULL_TO_STRING, 'nonsense'));
} catch (\TypeError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
@unlink(__DIR__."/foo.db");
?>
--EXPECT--
-Attribute value must be of type int for selected attribute, null given
+TypeError: Attribute value must be of type int for selected attribute, null given
bool(true)
-Attribute value must be of type int for selected attribute, string given
+TypeError: Attribute value must be of type int for selected attribute, string given
diff --git a/ext/pdo_sqlite/tests/gh14712.phpt b/ext/pdo_sqlite/tests/gh14712.phpt
index d565abacdcd..c0f0d003cbf 100644
--- a/ext/pdo_sqlite/tests/gh14712.phpt
+++ b/ext/pdo_sqlite/tests/gh14712.phpt
@@ -11,8 +11,8 @@
try {
$db->query("select 1 as queryStringxx")->fetch(PDO::FETCH_LAZY)->documentElement->firstChild->nextElementSibling->textContent = "é";
} catch (Error $e) {
- echo $e->getMessage();
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Attempt to modify property "firstChild" on null
+Error: Attempt to modify property "firstChild" on null
diff --git a/ext/pdo_sqlite/tests/gh9032.phpt b/ext/pdo_sqlite/tests/gh9032.phpt
index 332190484cf..a793a71cee5 100644
--- a/ext/pdo_sqlite/tests/gh9032.phpt
+++ b/ext/pdo_sqlite/tests/gh9032.phpt
@@ -16,9 +16,9 @@
$st->execute([':a' => ':memory:']);
var_dump($db->exec('create table db2.r (id int)'));
} catch (PDOException $ex) {
- echo $ex->getMessage(), PHP_EOL;
+ echo $ex::class, ': ', $ex->getMessage(), "\n";
}
?>
--EXPECT--
int(0)
-SQLSTATE[HY000]: General error: 23 not authorized
+PDOException: SQLSTATE[HY000]: General error: 23 not authorized
diff --git a/ext/pdo_sqlite/tests/open_basedir.phpt b/ext/pdo_sqlite/tests/open_basedir.phpt
index a82c3027aed..59e5fe273c2 100644
--- a/ext/pdo_sqlite/tests/open_basedir.phpt
+++ b/ext/pdo_sqlite/tests/open_basedir.phpt
@@ -11,21 +11,21 @@
try {
$db = new PDO('sqlite:../not_in_open_basedir.sqlite');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db = new PDO('sqlite:file:../not_in_open_basedir.sqlite');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db = new PDO('sqlite:file:../not_in_open_basedir.sqlite?mode=ro');
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-open_basedir prohibits opening ../not_in_open_basedir.sqlite
-open_basedir prohibits opening file:../not_in_open_basedir.sqlite
-open_basedir prohibits opening file:../not_in_open_basedir.sqlite?mode=ro
+PDOException: open_basedir prohibits opening ../not_in_open_basedir.sqlite
+PDOException: open_basedir prohibits opening file:../not_in_open_basedir.sqlite
+PDOException: open_basedir prohibits opening file:../not_in_open_basedir.sqlite?mode=ro
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite___construct_uri.phpt b/ext/pdo_sqlite/tests/pdo_sqlite___construct_uri.phpt
index 7fc686b2147..2f88ed8ea6d 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite___construct_uri.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite___construct_uri.phpt
@@ -26,7 +26,7 @@
try {
new PDO("uri:{$dsnFile}");
} catch (Throwable $e) {
- echo $e::class, ": ", $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
clearstatcache();
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
index 192eabbf74f..7ca31ee9c50 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
@@ -10,18 +10,18 @@
try {
$pdo->sqliteCreateAggregate('foo', 'a', '');
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$pdo->sqliteCreateAggregate('foo', 'strlen', '');
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: Method PDO::sqliteCreateAggregate() is deprecated since 8.5, use Pdo\Sqlite::createAggregate() instead in %s on line %d
-PDO::sqliteCreateAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
+TypeError: PDO::sqliteCreateAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
Deprecated: Method PDO::sqliteCreateAggregate() is deprecated since 8.5, use Pdo\Sqlite::createAggregate() instead in %s on line %d
-PDO::sqliteCreateAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name
+TypeError: PDO::sqliteCreateAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
index eb5ea6c97b7..b8308e7d7ef 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
@@ -29,7 +29,7 @@
try {
$db->query('SELECT name FROM test_pdo_sqlite_createcollation ORDER BY name COLLATE MYCOLLATEBAD');
} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
@@ -42,4 +42,4 @@
2
Deprecated: Method PDO::sqliteCreateCollation() is deprecated since 8.5, use Pdo\Sqlite::createCollation() instead in %s on line %d
-PDO::query(): Return value of the collation callback must be of type int, string returned
+TypeError: PDO::query(): Return value of the collation callback must be of type int, string returned
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
index ead2f7b6a83..b6249a8b416 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
@@ -13,10 +13,10 @@
try {
$db->sqliteCreateFunction('bar-alias', 'bar');
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECTF--
Deprecated: Method PDO::sqliteCreateFunction() is deprecated since 8.5, use Pdo\Sqlite::createFunction() instead in %s on line %d
-PDO::sqliteCreateFunction(): Argument #2 ($callback) must be a valid callback, function "bar" not found or invalid function name
+TypeError: PDO::sqliteCreateFunction(): Argument #2 ($callback) must be a valid callback, function "bar" not found or invalid function name
diff --git a/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt b/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
index 601ce24f515..ac0d31bd612 100644
--- a/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
@@ -9,7 +9,7 @@
try {
new Pdo\Pgsql('sqlite::memory:');
} catch (PDOException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
class MyPgsql extends Pdo\Pgsql
@@ -19,10 +19,10 @@ class MyPgsql extends Pdo\Pgsql
try {
new MyPgsql('sqlite::memory:');
} catch (PDOException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Pdo\Pgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead
-MyPgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead
+PDOException: Pdo\Pgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead
+PDOException: MyPgsql::__construct() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::__construct() or PDO::__construct() instead
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createafunction_arg_error.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createafunction_arg_error.phpt
index dce8ecf2878..7afa43ac9d3 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createafunction_arg_error.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createafunction_arg_error.phpt
@@ -18,32 +18,32 @@ public function __call(string $name, array $arguments) {
try {
$db->createFunction(null, [new TrampolineTest(), 'strtoupper']);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createFunction('strtoupper', null);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createFunction('strtoupper', [new TrampolineTest(), 'strtoupper'], null);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createFunction('strtoupper', [new TrampolineTest(), 'strtoupper'], 1, null);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo 'done!';
?>
--EXPECT--
-Pdo\Sqlite::createFunction(): Argument #1 ($function_name) must be of type string, null given
-Pdo\Sqlite::createFunction(): Argument #2 ($callback) must be a valid callback, no array or string given
-Pdo\Sqlite::createFunction(): Argument #3 ($num_args) must be of type int, null given
-Pdo\Sqlite::createFunction(): Argument #4 ($flags) must be of type int, null given
+TypeError: Pdo\Sqlite::createFunction(): Argument #1 ($function_name) must be of type string, null given
+TypeError: Pdo\Sqlite::createFunction(): Argument #2 ($callback) must be a valid callback, no array or string given
+TypeError: Pdo\Sqlite::createFunction(): Argument #3 ($num_args) must be of type int, null given
+TypeError: Pdo\Sqlite::createFunction(): Argument #4 ($flags) must be of type int, null given
done!
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_002.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_002.phpt
index 3419f554805..161a2d82044 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_002.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_002.phpt
@@ -11,15 +11,15 @@
try {
$pdo->createAggregate('foo', 'a', '');
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$pdo->createAggregate('foo', 'strlen', '');
} catch (\TypeError $e) {
- echo $e->getMessage() . \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
-Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name
+TypeError: Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, function "a" not found or invalid function name
+TypeError: Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, function "" not found or invalid function name
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_arg_error.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_arg_error.phpt
index 7707f8cae97..896aac27a55 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_arg_error.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_arg_error.phpt
@@ -18,46 +18,46 @@ public function __call(string $name, array $arguments) {
try {
$db->createAggregate(null, [new TrampolineTest(), 'step'], null, 1);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createAggregate(null, null, [new TrampolineTest(), 'step'], 1);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createAggregate(null, [new TrampolineTest(), 'step'], [new TrampolineTest(), 'step'], 1);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createAggregate('S', null, [new TrampolineTest(), 'finalize'], 1);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createAggregate('S', [new TrampolineTest(), 'step'], null, 1);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createAggregate('S', [new TrampolineTest(), 'step'], [new TrampolineTest(), 'finalize'], null);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo 'done!';
?>
--EXPECT--
-Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
-Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
-Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
-Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, no array or string given
-Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, no array or string given
-Pdo\Sqlite::createAggregate(): Argument #4 ($numArgs) must be of type int, null given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #1 ($name) must be of type string, null given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #2 ($step) must be a valid callback, no array or string given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #3 ($finalize) must be a valid callback, no array or string given
+TypeError: Pdo\Sqlite::createAggregate(): Argument #4 ($numArgs) must be of type int, null given
done!
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_arg_error.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_arg_error.phpt
index 16bb8b9333e..95b591b105c 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_arg_error.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_arg_error.phpt
@@ -18,18 +18,18 @@ public function __call(string $name, array $arguments) {
try {
$db->createCollation(null, [new TrampolineTest(), 'NAT']);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$db->createCollation('NAT', null);
} catch (Throwable $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo 'done!';
?>
--EXPECT--
-Pdo\Sqlite::createCollation(): Argument #1 ($name) must be of type string, null given
-Pdo\Sqlite::createCollation(): Argument #2 ($callback) must be a valid callback, no array or string given
+TypeError: Pdo\Sqlite::createCollation(): Argument #1 ($name) must be of type string, null given
+TypeError: Pdo\Sqlite::createCollation(): Argument #2 ($callback) must be a valid callback, no array or string given
done!
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt
index 2a493c21179..6c97860a661 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt
@@ -17,8 +17,8 @@
try {
$db->query("SELECT c FROM test ORDER BY c COLLATE NAT");
} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-PDO::query(): Return value of the collation callback must be of type int, string returned
+TypeError: PDO::query(): Return value of the collation callback must be of type int, string returned
diff --git a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_getsetattr_explain.phpt b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_getsetattr_explain.phpt
index d2a6c2a5f52..9604d4e1021 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_getsetattr_explain.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_getsetattr_explain.phpt
@@ -36,25 +36,25 @@ class Duh {}
try {
$stmts->setAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT, "EXPLAIN");
} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$stmts->setAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT, new Duh());
} catch (\TypeError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$stmts->setAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT, -1);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
try {
$stmts->setAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT, 256);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
var_dump($stmts->getAttribute(Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT) == Pdo\Sqlite::EXPLAIN_MODE_PREPARED);
@@ -393,8 +393,8 @@ class Duh {}
string(13) "second_insert"
}
}
-explain mode must be of type int, string given
-explain mode must be of type int, Duh given
-explain mode must be one of the Pdo\Sqlite::EXPLAIN_MODE_* constants
-explain mode must be one of the Pdo\Sqlite::EXPLAIN_MODE_* constants
+TypeError: explain mode must be of type int, string given
+TypeError: explain mode must be of type int, Duh given
+ValueError: explain mode must be one of the Pdo\Sqlite::EXPLAIN_MODE_* constants
+ValueError: explain mode must be one of the Pdo\Sqlite::EXPLAIN_MODE_* constants
bool(true)
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
index 24120f1d820..19da0daaeba 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
@@ -9,9 +9,9 @@
try {
Pdo\Pgsql::connect('sqlite::memory:');
} catch (PDOException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-Pdo\Pgsql::connect() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::connect() or PDO::connect() instead
+PDOException: Pdo\Pgsql::connect() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::connect() or PDO::connect() instead
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_007.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_007.phpt
index 58568abe736..cc8cdec7896 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_007.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_007.phpt
@@ -10,9 +10,9 @@ class MyPDO extends PDO {}
try {
MyPDO::connect('sqlite::memory:');
} catch (PDOException $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
--EXPECT--
-MyPDO::connect() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::connect() or PDO::connect() instead
+PDOException: MyPDO::connect() cannot be used for connecting to the "sqlite" driver, either call Pdo\Sqlite::connect() or PDO::connect() instead
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_load_extension_failure.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_load_extension_failure.phpt
index 75f3de6b581..829f515ece6 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_load_extension_failure.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_load_extension_failure.phpt
@@ -22,7 +22,7 @@
echo "Failed to throw exception";
}
catch (PDOException $pdoException) {
- echo $pdoException->getMessage() . "\n";
+ echo $pdoException::class, ': ', $pdoException->getMessage(), "\n";
}
try {
@@ -31,14 +31,14 @@
echo "Failed to throw exception";
}
catch (PDOException $pdoException) {
- echo $pdoException->getMessage() . "\n";
+ echo $pdoException::class, ': ', $pdoException->getMessage(), "\n";
}
echo "Fin.";
?>
--EXPECTF--
Loading non-existent file.
-Unable to load extension "/this/does/not_exist"
+PDOException: Unable to load extension "/this/does/not_exist"
Loading invalid file.
-Unable to load extension "%a"
+PDOException: Unable to load extension "%a"
Fin.
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
index d1e9039ea1c..92a9b28a3cf 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
@@ -22,7 +22,7 @@
// This one should fail
var_dump($db->exec('CREATE TABLE test (a, b);'));
} catch (\Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
// Test disabling the authorizer
@@ -51,7 +51,7 @@
try {
var_dump($db->query('SELECT 1;'));
} catch (\Error $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$db->setAuthorizer(function () {
@@ -61,7 +61,7 @@
try {
var_dump($db->query('SELECT 1;'));
} catch (\Error $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -70,7 +70,7 @@
["queryString"]=>
string(9) "SELECT 1;"
}
-SQLSTATE[HY000]: General error: 23 not authorized
+PDOException: SQLSTATE[HY000]: General error: 23 not authorized
int(1)
int(1)
string(6) "SELECT"
@@ -97,5 +97,5 @@
string(4) "READ"
string(28) "sqlite_master,rootpage,main,"
int(1)
-PDO::query(): Return value of the authorizer callback must be of type int, string returned
-PDO::query(): Return value of the authorizer callback must be one of Pdo\Sqlite::OK, Pdo\Sqlite::DENY, or Pdo\Sqlite::IGNORE
+TypeError: PDO::query(): Return value of the authorizer callback must be of type int, string returned
+ValueError: PDO::query(): Return value of the authorizer callback must be one of Pdo\Sqlite::OK, Pdo\Sqlite::DENY, or Pdo\Sqlite::IGNORE
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline.phpt
index c93a1f2e34a..1bceccb4857 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline.phpt
@@ -29,7 +29,7 @@ public function __call(string $name, array $arguments) {
// This one should fail
var_dump($db->query('CREATE TABLE test (a, b);'));
} catch (\Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -40,4 +40,4 @@ public function __call(string $name, array $arguments) {
string(9) "SELECT 1;"
}
Trampoline for authorizer
-SQLSTATE[HY000]: General error: 23 not authorized
+PDOException: SQLSTATE[HY000]: General error: 23 not authorized
diff --git a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline_no_leak.phpt b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline_no_leak.phpt
index 84b83877b94..c6f240120c9 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline_no_leak.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline_no_leak.phpt
@@ -25,7 +25,7 @@ public function __call(string $name, array $arguments) {
try {
var_dump($obj->setAuthorizer($callback));
} catch (\Throwable $e) {
- echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>