From: Adam Baratz Date: Fri, 8 May 2020 18:45:37 +0000 (-0400) Subject: Set non-default error mode to maintain expected behavior X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bba9bc686308a3c99bcbf7f80a0068968030595d;p=php Set non-default error mode to maintain expected behavior --- 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";