#43663 [Asn->Csd]: Extending PDO class with a __call() function doesn't work
| From: | dsp@php.net | Date: | Sun, 30 Dec 2007 18:01:22 +0000 |
| Subject: | #43663 [Asn->Csd]: Extending PDO class with a __call() function doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120948@lists.php.net to get a copy of this message | ||
ID: 43663
Updated by: dsp@php.net
Reported By: anthony dot parsons at manx dot net
-Status: Assigned
+Status: Closed
Bug Type: PDO related
Operating System: Linux 2.6.23 (Gentoo)
PHP Version: 5.2.5
-Assigned To:
+Assigned To: dsp
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-12-23 23:08:00] 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"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43663&edit=1