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