1--TEST--
2PDO MySQL PECL Bug #5780 (Failure to produce an error when one is expected)
3--SKIPIF--
4<?php # vim:ft=php:
5if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6require dirname(__FILE__) . '/config.inc';
7require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
8PDOTest::skip();
9?>
10--FILE--
11<?php
12require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
13$db = PDOTest::test_factory(dirname(__FILE__). '/common.phpt');
14
15$db->exec("CREATE TABLE test (login varchar(32) NOT NULL, data varchar(64) NOT NULL)");
16$db->exec("CREATE TABLE test2 (login varchar(32) NOT NULL, password varchar(64) NOT NULL)");
17$db->exec("INSERT INTO test2 (login, password) VALUES ('testing', 'testing')");
18$db->exec("INSERT INTO test2 (login, password) VALUES ('test2', 'testpw2')");
19
20$logstmt = $db->prepare('INSERT INTO test (login, data) VALUES (:var1, :var2)');
21$authstmt = $db->prepare('SELECT * FROM test2 WHERE login = :varlog AND password = :varpass');
22$authstmt->execute(array(':varlog' => 'testing', ':varpass' => 'testing'));
23var_dump($authstmt->fetch(PDO::FETCH_NUM));
24@var_dump($logstmt->execute(array(':var1' => 'test1', ':var2' => 'test2')));
25$info = $logstmt->errorInfo();
26unset($info[2]);
27var_dump($info);
28?>
29--CLEAN--
30<?php
31require dirname(__FILE__) . '/mysql_pdo_test.inc';
32$db = MySQLPDOTest::factory();
33$db->exec('DROP TABLE IF EXISTS test');
34$db->exec('DROP TABLE IF EXISTS test2');
35?>
36--EXPECTF--
37array(2) {
38  [0]=>
39  string(7) "testing"
40  [1]=>
41  string(7) "testing"
42}
43bool(true)
44array(2) {
45  [0]=>
46  string(5) "00000"
47  [1]=>
48  NULL
49}
50