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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: doctorrock83 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC