php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46396 __call() not called on classes extending PDOStatement
Submitted: 2008-10-26 18:30 UTC Modified: 2008-10-26 19:27 UTC
From: doctorrock83 at gmail dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5.2.6 OS: Windows XP
Private report: No CVE-ID: None
 [2008-10-26 18:30 UTC] doctorrock83 at gmail dot com
Description:
------------
When extending PDOStatement, it looks like PHP's engine doesn't know anything about a possible __call() method into it.
#43663 was the same but for PDO instances

Reproduce code:
---------------
class Mystatement extends PDOStatement 
{
    public function __call($m, $a)
    {
        echo "called $m";
    }
}
$pdo = new PDO('mysql:host=localhost;dbname=myDB','login','secret');
$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Mystatement'));

$s = $pdo->query("SELECT * FROM members"); // should be OK

$s->idontexist();

Expected result:
----------------
called idontexist

Actual result:
--------------
Fatal error: Call to undefined method Mystatement::idontexist() in XXX on line xxxx


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-26 19:27 UTC] johannes@php.net
This bug has been fixed in CVS.

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.

This is fixed for some time in CVS now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 20:01:29 2024 UTC