1--TEST-- 2PDO Common: Bug #50458 (PDO::FETCH_FUNC fails with Closures) 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 17$db = PDOTest::factory(); 18$db->exec("CREATE TABLE test50458 (a VARCHAR(10))"); 19$db->exec("INSERT INTO test50458 (a) VALUES ('xyz')"); 20$res = $db->query("SELECT a FROM test50458"); 21var_dump($res->fetchAll(PDO::FETCH_FUNC, function($a) { return strtoupper($a); })); 22 23?> 24--CLEAN-- 25<?php 26require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 27$db = PDOTest::factory(); 28PDOTest::dropTableIfExists($db, "test50458"); 29?> 30--EXPECT-- 31array(1) { 32 [0]=> 33 string(3) "XYZ" 34} 35