[php-src] master: ext/pdo_sqlite: applied fixers to improve test robustness (#23032)
NickSdot via GitHub <[email protected]>
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-08-07T19:29:50+01:00
Commit: https://github.com/php/php-src/commit/59ad20920610af2608efdbbe4176e8d8b0da73d3
Raw diff: https://github.com/php/php-src/commit/59ad20920610af2608efdbbe4176e8d8b0da73d3.diff
ext/pdo_sqlite: applied fixers to improve test robustness (#23032)
Changed paths:
M ext/pdo_sqlite/tests/bug66033.phpt
M ext/pdo_sqlite/tests/bug81227.phpt
M ext/pdo_sqlite/tests/bug_44159_sqlite_version.phpt
M ext/pdo_sqlite/tests/gh14712.phpt
M ext/pdo_sqlite/tests/gh9032.phpt
M ext/pdo_sqlite/tests/open_basedir.phpt
M ext/pdo_sqlite/tests/pdo_sqlite___construct_uri.phpt
M ext/pdo_sqlite/tests/pdo_sqlite_createaggregate_002.phpt
M ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
M ext/pdo_sqlite/tests/pdo_sqlite_createfunction_002.phpt
M ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createafunction_arg_error.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_002.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate_arg_error.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_arg_error.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createcollation_wrong_callback.phpt
M ext/pdo_sqlite/tests/subclasses/pdo_sqlite_getsetattr_explain.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_007.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_load_extension_failure.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline.phpt
M ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer_trampoline_no_leak.phpt
Diff:
diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt
index a45d34a580e6..611cc59c982d 100644
--- a/ext/pdo_sqlite/tests/bug66033.phpt
+++ b/ext/pdo_sqlite/tests/bug66033.phpt
@@ -24,8 +24,8 @@ $pdo->exec("CREATE TABLE IF NOT EXISTS messages (
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 b15818e8a137..8fc469ed36f9 100644
--- a/ext/pdo_sqlite/tests/bug81227.phpt
+++ b/ext/pdo_sqlite/tests/bug81227.phpt
@@ -13,7 +13,7 @@ var_dump($db->inTransaction());
try {
$db->beginTransaction();
} catch (PDOException $e) {
- echo $e->getMessage(), "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
$db->commit();
@@ -25,6 +25,6 @@ var_dump($db->inTransaction());
--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 69cd0897e388..d22f7c7a85bc 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 @@ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
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 d565abacdcd1..c0f0d003cbfb 100644
--- a/ext/pdo_sqlite/tests/gh14712.phpt
+++ b/ext/pdo_sqlite/tests/gh14712.phpt
@@ -11,8 +11,8 @@ $db = new PDO('sqlite::memory:');
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 332190484cfb..a793a71cee5b 100644
--- a/ext/pdo_sqlite/tests/gh9032.phpt
+++ b/ext/pdo_sqlite/tests/gh9032.phpt
@@ -16,9 +16,9 @@ $st = $db->prepare('attach database :a AS "db2"');
$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 a82c3027aed0..59e5fe273c2c 100644
--- a/ext/pdo_sqlite/tests/open_basedir.phpt
+++ b/ext/pdo_sqlite/tests/open_basedir.phpt
@@ -11,21 +11,21 @@ chdir(__DIR__);
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 7fc686b21472..2f88ed8ea6d1 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 @@ var_dump(file_exists($dbFile));
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 192eabbf74fd..7ca31ee9c50d 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 @@ $pdo = new PDO('sqlite::memory:');
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 eb5ea6c97b7d..b8308e7d7ef3 100644
--- a/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
+++ b/ext/pdo_sqlite/tests/pdo_sqlite_createcollation.phpt
@@ -29,7 +29,7 @@ $db->sqliteCreateCollation('MYCOLLATEBAD', function($a, $b) { return $a; });
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 @@ Deprecated: Method PDO::sqliteCreateCollation() is deprecated since 8.5, use Pdo
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 ead2f7b6a830..b6249a8b4165 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 @@ $db = new PDO( 'sqlite::memory:');
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 601ce24f5152..ac0d31bd6122 100644
--- a/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/gh_16131.phpt
@@ -9,7 +9,7 @@ pdo_sqlite
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 dce8ecf28785..7afa43ac9d3c 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 @@ class TrampolineTest {
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 3419f5548057..161a2d820446 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 @@ $pdo = new Pdo\Sqlite('sqlite::memory:');
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 7707f8cae978..896aac27a558 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 @@ class TrampolineTest {
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 16bb8b9333e4..95b591b105c2 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 @@ class TrampolineTest {
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 2a493c211797..6c97860a6617 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 @@ $db->createCollation('NAT', function($a, $b): string { return $a . $b; });
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 d2a6c2a5f52b..9604d4e10212 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 @@ array(2) {
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 24120f1d8205..19da0daaebab 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_005.phpt
@@ -9,9 +9,9 @@ pdo_sqlite
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 58568abe7363..cc8cdec78967 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 75f3de6b581a..829f515ece64 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 @@ try {
echo "Failed to throw exception";
}
catch (PDOException $pdoException) {
- echo $pdoException->getMessage() . "\n";
+ echo $pdoException::class, ': ', $pdoException->getMessage(), "\n";
}
try {
@@ -31,14 +31,14 @@ try {
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 d1e9039ea1c4..92a9b28a3cfb 100644
--- a/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
+++ b/ext/pdo_sqlite/tests/subclasses/pdosqlite_setauthorizer.phpt
@@ -22,7 +22,7 @@ try {
// 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 @@ $db->setAuthorizer(function () {
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 @@ $db->setAuthorizer(function () {
try {
var_dump($db->query('SELECT 1;'));
} catch (\Error $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>
@@ -70,7 +70,7 @@ object(PDOStatement)#%d (1) {
["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(28) "sqlite_master,rootpage,main,"
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 c93a1f2e34a5..1bceccb48570 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 @@ try {
// 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 @@ object(PDOStatement)#%d (1) {
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 84b83877b94a..c6f240120c92 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 @@ $obj = $rc->newInstanceWithoutConstructor();
try {
var_dump($obj->setAuthorizer($callback));
} catch (\Throwable $e) {
- echo $e::class, ': ', $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
?>