php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #72368
Patch bug72368_test revision 2016-07-10 05:35 UTC by mbeccati@php.net

Patch bug72368_test for PDO MySQL Bug #72368

Patch version 2016-07-10 05:35 UTC

Return to Bug #72368 | Download this patch
Patch Revisions:

Developer: mbeccati@php.net

diff --git a/ext/pdo/tests/bug_72368.phpt b/ext/pdo/tests/bug_72368.phpt
new file mode 100644
index 0000000..db8d499
--- /dev/null
+++ b/ext/pdo/tests/bug_72368.phpt
@@ -0,0 +1,43 @@
+--TEST--
+PDO Common: Bug #72368 (PdoStatement->execute() fails but does not throw an exception)
+--SKIPIF--
+<?php # vim:ft=php
+if (!extension_loaded('pdo')) die('skip');
+$dir = getenv('REDIR_TEST_DIR');
+if (false == $dir) die('skip no driver');
+require_once $dir . 'pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
+require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
+$db = PDOTest::factory();
+$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+$params = [":bar" => 1];
+$sql = "SELECT 1";
+
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
+try {
+	$stmt = $db->prepare($sql);
+	var_dump($stmt->execute($params));
+} catch (PDOException $e) {
+	var_dump('ERR');
+}
+
+
+$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
+try {
+	$stmt = $db->prepare($sql);
+	var_dump($stmt->execute($params));
+} catch (PDOException $e) {
+	var_dump('ERR');
+}
+
+?>
+===DONE===
+--EXPECT--
+string(3) "ERR"
+string(3) "ERR"
+===DONE===
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 16:03:34 2021 UTC