1--TEST-- 2PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries) 3--EXTENSIONS-- 4pdo_mysql 5--SKIPIF-- 6<?php 7require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 8MySQLPDOTest::skip(); 9?> 10--FILE-- 11<?php 12require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 13$db = MySQLPDOTest::factory(); 14 15$db->exec('CREATE TABLE test_33689 (bar INT NOT NULL)'); 16$db->exec('INSERT INTO test_33689 VALUES(1)'); 17 18var_dump($db->query('SELECT * FROM test_33689')); 19foreach ($db->query('SELECT * FROM test_33689') as $row) { 20 print_r($row); 21} 22 23$stmt = $db->prepare('SELECT * FROM test_33689'); 24print_r($stmt->getColumnMeta(0)); 25$stmt->execute(); 26$tmp = $stmt->getColumnMeta(0); 27 28// libmysql and mysqlnd will show the pdo_type entry at a different position in the hash 29// and will report a different type, as mysqlnd returns native types. 30if (!isset($tmp['pdo_type']) || ($tmp['pdo_type'] != 1 && $tmp['pdo_type'] != 2)) 31 printf("Expecting pdo_type = 1 got %s\n", $tmp['pdo_type']); 32else 33 unset($tmp['pdo_type']); 34 35print_r($tmp); 36?> 37--CLEAN-- 38<?php 39require_once __DIR__ . '/inc/mysql_pdo_test.inc'; 40$db = MySQLPDOTest::factory(); 41$db->exec('DROP TABLE IF EXISTS test_33689'); 42?> 43--EXPECTF-- 44object(PDOStatement)#%d (1) { 45 ["queryString"]=> 46 string(24) "SELECT * FROM test_33689" 47} 48Array 49( 50 [bar] => 1 51 [0] => 1 52) 53Array 54( 55 [native_type] => LONG 56 [flags] => Array 57 ( 58 [0] => not_null 59 ) 60 61 [table] => test_33689 62 [name] => bar 63 [len] => 11 64 [precision] => 0 65) 66