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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 14:01:29 2024 UTC