xref: /php-src/ext/pdo/tests/bug_72368.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #72368 (PdoStatement->execute() fails but does not throw an exception)
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?php # vim:ft=php
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16$db = PDOTest::factory();
17$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
18
19$params = [":bar" => 1];
20$sql = "SELECT 1";
21
22$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
23try {
24	$stmt = $db->prepare($sql);
25	var_dump($stmt->execute($params));
26} catch (PDOException $e) {
27	var_dump('ERR');
28}
29
30
31$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
32try {
33	$stmt = $db->prepare($sql);
34	var_dump($stmt->execute($params));
35} catch (PDOException $e) {
36	var_dump('ERR');
37}
38
39?>
40===DONE===
41--EXPECT--
42string(3) "ERR"
43string(3) "ERR"
44===DONE===
45