1--TEST-- 2PDO Common: Bug #43139 (PDO ignore ATTR_DEFAULT_FETCH_MODE in some cases with fetchAll()) 3--EXTENSIONS-- 4pdo 5--SKIPIF-- 6<?php 7$dir = getenv('REDIR_TEST_DIR'); 8if (false == $dir) die('skip no driver'); 9require_once $dir . 'pdo_test.inc'; 10PDOTest::skip(); 11?> 12--FILE-- 13<?php 14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/'); 15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 16$db = PDOTest::factory(); 17 18$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); 19$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); 20 21switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) { 22 case 'oci': $from = ' FROM DUAL'; break; 23 case 'firebird': $from = ' FROM RDB$DATABASE'; break; 24 default: $from = ''; break; 25} 26 27var_dump($db->query("select 0 as abc, 1 as xyz, 2 as def $from")->fetchAll(PDO::FETCH_GROUP)); 28?> 29--EXPECT-- 30array(1) { 31 [0]=> 32 array(1) { 33 [0]=> 34 array(2) { 35 ["xyz"]=> 36 string(1) "1" 37 ["def"]=> 38 string(1) "2" 39 } 40 } 41} 42