Skip to content

Commit 1f276da

Browse files
committed
Try-catch for SQLite dedicated bug
1 parent c868639 commit 1f276da

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ext/pdo/tests/bug_44159.phpt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@ $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
1717
$attrs = array(PDO::ATTR_STATEMENT_CLASS, PDO::ATTR_STRINGIFY_FETCHES, PDO::NULL_TO_STRING);
1818

1919
foreach ($attrs as $attr) {
20-
var_dump($pdo->setAttribute($attr, NULL));
21-
var_dump($pdo->setAttribute($attr, 1));
22-
var_dump($pdo->setAttribute($attr, 'nonsense'));
20+
try {
21+
var_dump($pdo->setAttribute($attr, NULL));
22+
} catch (\Error $e) {
23+
echo get_class($e), ': ', $e->getMessage(), \PHP_EOL;
24+
}
25+
try {
26+
var_dump($pdo->setAttribute($attr, 1));
27+
} catch (\Error $e) {
28+
echo get_class($e), ': ', $e->getMessage(), \PHP_EOL;
29+
}
30+
try {
31+
var_dump($pdo->setAttribute($attr, 'nonsense'));
32+
} catch (\Error $e) {
33+
echo get_class($e), ': ', $e->getMessage(), \PHP_EOL;
34+
}
2335
}
2436

2537
@unlink(__DIR__."/foo.db");

0 commit comments

Comments
 (0)