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
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.
(description)
Block user comment
Status: Assign to:
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

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-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 17:03:14 2021 UTC