1--TEST-- 2PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries) 3--SKIPIF-- 4<?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__) . '/config.inc'; 13require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; 14$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); 15 16$db->exec('CREATE TABLE test (bar INT NOT NULL)'); 17$db->exec('INSERT INTO test VALUES(1)'); 18 19var_dump($db->query('SELECT * from test')); 20foreach ($db->query('SELECT * from test') as $row) { 21 print_r($row); 22} 23 24$stmt = $db->prepare('SELECT * from test'); 25print_r($stmt->getColumnMeta(0)); 26$stmt->execute(); 27$tmp = $stmt->getColumnMeta(0); 28 29// libmysql and mysqlnd will show the pdo_type entry at a different position in the hash 30if (!isset($tmp['pdo_type']) || (isset($tmp['pdo_type']) && $tmp['pdo_type'] != 2)) 31 printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']); 32else 33 unset($tmp['pdo_type']); 34 35print_r($tmp); 36?> 37--CLEAN-- 38<?php 39require dirname(__FILE__) . '/mysql_pdo_test.inc'; 40MySQLPDOTest::dropTestTable(); 41?> 42--EXPECTF-- 43object(PDOStatement)#%d (1) { 44 [%u|b%"queryString"]=> 45 %unicode|string%(18) "SELECT * from test" 46} 47Array 48( 49 [bar] => 1 50 [0] => 1 51) 52Array 53( 54 [native_type] => LONG 55 [flags] => Array 56 ( 57 [0] => not_null 58 ) 59 60 [table] => test 61 [name] => bar 62 [len] => 11 63 [precision] => 0 64) 65