php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56613 PDO_FETCH_FUNC on uppcase function name
Submitted: 2005-10-24 23:41 UTC Modified: 2005-10-28 23:12 UTC
From: ezdevelop at gmail dot com Assigned: helly (profile)
Status: Closed Package: PDO (PECL)
PHP Version: 5.1.0 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ezdevelop at gmail dot com
New email:
PHP Version: OS:

 

 [2005-10-24 23:41 UTC] ezdevelop at gmail dot com
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
(
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-24 23:43 UTC] ezdevelop at gmail dot com
Reproduce code:
---------------
print_r($stmt->fetchAll(PDO_FETCH_FUNC, 'toXML')); // not work
print_r($stmt->fetchAll(PDO_FETCH_FUNC, 'toxml')); // work fine
 [2005-10-28 23:12 UTC] wez@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 13:01:31 2024 UTC