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