1--TEST-- 2PDO Common: Bug #50458 (PDO::FETCH_FUNC fails with Closures) 3--SKIPIF-- 4<?php # vim:ft=php 5if (!extension_loaded('pdo')) die('skip'); 6$dir = getenv('REDIR_TEST_DIR'); 7if (false == $dir) die('skip no driver'); 8require_once $dir . 'pdo_test.inc'; 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 14require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 15 16$db = PDOTest::factory(); 17$db->exec("CREATE TABLE test (a VARCHAR(10))"); 18$db->exec("INSERT INTO test (a) VALUES ('xyz')"); 19$res = $db->query("SELECT a FROM test"); 20var_dump($res->fetchAll(PDO::FETCH_FUNC, function($a) { return strtoupper($a); })); 21 22?> 23===DONE=== 24--EXPECTF-- 25array(1) { 26 [0]=> 27 string(3) "XYZ" 28} 29===DONE=== 30