xref: /php-src/ext/pdo/tests/bug_34687.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #34687 (query doesn't return error information)
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?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='.__DIR__ . '/../../pdo/tests/');
15require getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16$db = PDOTest::factory();
17
18$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
19$x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'");
20
21var_dump($x);
22$code = $db->errorCode();
23if ($code !== '00000' && strlen($code)) {
24    echo "OK: $code\n";
25} else {
26    echo "ERR: $code\n";
27    print_r($db->errorInfo());
28}
29
30?>
31--EXPECTF--
32bool(false)
33OK: %s
34