php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50458 PDO::FETCH_FUNC fails with Closures
Submitted: 2009-12-12 13:01 UTC Modified: 2009-12-14 03:45 UTC
From: m dot kurzyna at crystalpoint dot pl Assigned:
Status: Closed Package: PDO related
PHP Version: 5.3.1 OS: Linux
Private report: No CVE-ID: None
 [2009-12-12 13:01 UTC] m dot kurzyna at crystalpoint dot pl
Description:
------------
PDOStatement::fetchAll(PDO::FETCH_FUNC,function() {}) fails not being able to recognize Closure as valid callback.

Reproduce code:
---------------
<?php
 $db = new PDO('sqlite::memory:');
 $db->exec('CREATE TABLE `a` ( `id` INTEGER )');

 $st = $db->query('SELECT * FROM `a`');
 $st->fetchAll(PDO::FETCH_FUNC,function() {});
?>


Expected result:
----------------
No error

Actual result:
--------------
Warning: PDOStatement::fetchAll() [pdostatement.fetchall]: SQLSTATE[HY000]: General error: user-supplied function must be a valid callback in ... on line 6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-14 03:44 UTC] svn@php.net
Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=292107
Log: - Fixed bug #50458 (PDO::FETCH_FUNC fails with Closures)
 [2009-12-14 03:45 UTC] pierrick@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC