summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAdam Baratz <adambaratz@php.net>2020-05-08 14:45:37 -0400
committerAdam Baratz <adambaratz@php.net>2020-05-08 14:45:37 -0400
commitbba9bc686308a3c99bcbf7f80a0068968030595d (patch)
tree7aa9b953d10fddd541fb404a529e1adef0975b13 /ext
parente295266f8f80cb9001e35a6701d92dcad37a18a9 (diff)
downloadphp-git-bba9bc686308a3c99bcbf7f80a0068968030595d.tar.gz
Set non-default error mode to maintain expected behavior
Diffstat (limited to 'ext')
-rw-r--r--ext/pdo_dblib/tests/timeout.phpt6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/pdo_dblib/tests/timeout.phpt b/ext/pdo_dblib/tests/timeout.phpt
index 2ef20fd4fc..a070b0da75 100644
--- a/ext/pdo_dblib/tests/timeout.phpt
+++ b/ext/pdo_dblib/tests/timeout.phpt
@@ -20,6 +20,7 @@ if ($stmt->execute()) {
// regular timeout attribute, set after instance created, will affect query timeout, causing this query to fail
$db = new PDO($dsn, $user, $pass);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$db->setAttribute(PDO::ATTR_TIMEOUT, 1);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
@@ -33,6 +34,7 @@ if (!$stmt->execute()) {
// pdo_dblib-specific timeout attribute, set after instance created, will control query timeout, causing this query to fail
$db = new PDO($dsn, $user, $pass);
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$db->setAttribute(PDO::DBLIB_ATTR_QUERY_TIMEOUT, 1);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
@@ -45,7 +47,7 @@ if (!$stmt->execute()) {
}
// regular timeout attribute will affect query timeout, causing this query to fail
-$db = new PDO($dsn, $user, $pass, [PDO::ATTR_TIMEOUT => 1]);
+$db = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::ATTR_TIMEOUT => 1]);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
echo "OK\n";
@@ -57,7 +59,7 @@ if (!$stmt->execute()) {
}
// pdo_dblib-specific timeout attribute will control query timeout, causing this query to fail
-$db = new PDO($dsn, $user, $pass, [PDO::DBLIB_ATTR_QUERY_TIMEOUT => 1]);
+$db = new PDO($dsn, $user, $pass, [PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT, PDO::DBLIB_ATTR_QUERY_TIMEOUT => 1]);
$stmt = $db->prepare($sql);
if (!$stmt->execute()) {
echo "OK\n";