1--TEST--
2MySQL PDO->prepare(), native PS, mixed, wired style
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
6require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7MySQLPDOTest::skip();
8$db = MySQLPDOTest::factory();
9?>
10--FILE--
11<?php
12	require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
13	$db = MySQLPDOTest::factory();
14	MySQLPDOTest::createTestTable($db);
15
16	$db->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, 0);
17	if (0 != $db->getAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY))
18		printf("[002] Unable to turn off emulated prepared statements\n");
19
20	$stmt = $db->query('DELETE FROM test');
21	$stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, ?), (2, ?)');
22	$stmt->execute(array('a', 'b'));
23	$stmt = $db->prepare("SELECT id, label FROM test WHERE id = :placeholder AND label = (SELECT label AS 'SELECT' FROM test WHERE id = ?)");
24	$stmt->execute(array(1, 1));
25	var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
26
27	print "done!";
28?>
29--CLEAN--
30<?php
31require dirname(__FILE__) . '/mysql_pdo_test.inc';
32MySQLPDOTest::dropTestTable();
33?>
34--EXPECTF--
35Warning: PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters in %s on line %d
36
37Warning: PDO::prepare(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
38
39Fatal error: Uncaught Error: Call to a member function execute() on boolean in %s:%d
40Stack trace:
41#0 {main}
42  thrown in %s on line %d
43