php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43663 Extending PDO class with a __call() function doesn't work
Submitted: 2007-12-23 23:08 UTC Modified: 2007-12-30 18:01 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: anthony dot parsons at manx dot net Assigned: dsp (profile)
Status: Closed Package: PDO related
PHP Version: 5.2.5 OS: Linux 2.6.23 (Gentoo)
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: anthony dot parsons at manx dot net
New email:
PHP Version: OS:

 

 [2007-12-23 23:08 UTC] anthony dot parsons at manx dot net
Description:
------------
With a user-defined class that extends PDO, a __call() method does 
nothing at all. The class behaves as if it didn't exist.

I've tested it on a few other internal classes (the xml-related 
ones) where it works fine, and also with all but the PDO extension 
disabled with the same result.


Reproduce code:
---------------
<?php
class test extends PDO {
    function __call($name, array $args) {
        echo "Called $name in ".__CLASS__.'<br>';
    }
    function foo() {
        echo "Called foo in ".__CLASS__.'<br>';
    }
}
$a = new test('sqlite::memory:');
$a->foo();
$a->bar();
?>

Expected result:
----------------
"Called foo in test
Called bar in test"

Actual result:
--------------
"Called foo in test

 Fatal error: Call to undefined method test::bar() in call.php on 
line 24"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-30 18:01 UTC] dsp@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC