|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 16:03:35 2022 UTC