|  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
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:
Bug Type:
From: doctorrock83 at gmail dot com
New email:
PHP Version: OS:


 [2008-10-26 18:30 UTC] doctorrock83 at gmail dot com
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


Expected result:
called idontexist

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-26 19:27 UTC]
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
Thank you for the report, and for helping us make PHP better.

This is fixed for some time in CVS now.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Jun 02 14:03:42 2023 UTC