From bba9bc686308a3c99bcbf7f80a0068968030595d Mon Sep 17 00:00:00 2001 From: Adam Baratz Date: Fri, 8 May 2020 14:45:37 -0400 Subject: [PATCH] Set non-default error mode to maintain expected behavior --- ext/pdo_dblib/tests/timeout.phpt | 6 ++++-- 1 file 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"; -- 2.50.1