|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-24 23:43 UTC] ezdevelop at gmail dot com
[2005-10-28 23:12 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 21:00:02 2025 UTC |
Description: ------------ PDO_FETCH_FUNC doesn't know the uppcase function name. Reproduce code: --------------- <?php $x = new PDO("sqlite::memory:"); $x->query("create table test(name string, value string)"); $stmt = $x->prepare("INSERT INTO test (NAME, VALUE) VALUES (:name, :value)"); $stmt->bindParam(":name", $the_name, PDO_PARAM_STR, 32); $stmt->bindParam(":value", $the_value, PDO_PARAM_STR, 32); for ($i = 0; $i < 4; $i++) { $the_name = "foo" . rand(); $the_value = "bar" . rand(); if (!$stmt->execute()) { break; } } $stmt = $x->query("SELECT * FROM test"); function toXML($foo, $bar) { return "<name>$foo</name><value>$bar</value>"; } print_r($stmt->fetchAll(PDO_FETCH_FUNC, 'toXML')); // not work print_r($stmt->fetchAll(PDO_FETCH_FUNC, 'toXML')); // work fine ?> Expected result: ---------------- Array ( [0] => <name>foo2052</name><value>bar20973</value> [1] => <name>foo18466</name><value>bar17075</value> [2] => <name>foo8304</name><value>bar8169</value> [3] => <name>foo17518</name><value>bar22287</value> ) Actual result: -------------- C:\php-5.0.5>php pdo.php PHP Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: user-supplied function does not exist in C:\php-5.0.5\pdo.php on line 26 Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: user-supplied function does not exist in C:\php-5.0.5\pdo.php on line 26 PHP Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: user-supplied function does not exist in C:\php-5.0.5\pdo.php on line 26 Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: user-supplied function does not exist in C:\php-5.0.5\pdo.php on line 26 Array ( )