xref: /PHP-7.2/ext/pdo/tests/bug_34687.phpt (revision 1f655451)
1--TEST--
2PDO Common: Bug #34687 (query doesn't return error information)
3--SKIPIF--
4<?php # vim:ft=php
5if (!extension_loaded('pdo')) die('skip');
6$dir = getenv('REDIR_TEST_DIR');
7if (false == $dir) die('skip no driver');
8require_once $dir . 'pdo_test.inc';
9PDOTest::skip();
10?>
11--FILE--
12<?php
13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
14require getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
15$db = PDOTest::factory();
16
17$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
18$x = $db->query("UPDATE non_existent_pdo_test_table set foo = 'bar'");
19
20var_dump($x);
21$code = $db->errorCode();
22if ($code !== '00000' && strlen($code)) {
23	echo "OK: $code\n";
24} else {
25	echo "ERR: $code\n";
26	print_r($db->errorInfo());
27}
28
29?>
30--EXPECTF--
31bool(false)
32OK: %s
33