#46542 [Opn->Asn]: Extending PDO class with a __call() function doesn't work as expected

From: Date: Tue, 11 Nov 2008 17:40:39 +0000
Subject: #46542 [Opn->Asn]: Extending PDO class with a __call() function doesn't work as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130894@lists.php.net to get a copy of this message
ID: 46542 Updated by: johannes@php.net Reported By: myardbenoit at gmail dot com -Status: Open +Status: Assigned Bug Type: PDO related Operating System: GNU/Linux PHP Version: 5.2.6 -Assigned To: +Assigned To: johannes New Comment: Thanks for the report, I could verify it and have a fix quite ready .. just testing it. Yes, __call and PDO is a bit weird in some situations: in current PHP versions there's a bug that a __call() method is not called if a driver has no own methods (like PDO_mysql) but that bug is fixed in CVS for some time. Previous Comments: ------------------------------------------------------------------------ [2008-11-11 10:23:16] myardbenoit at gmail dot com Description: ------------ A user-defined class extending PDO will have troubles with __call(): the method name passed to __call() is always lowercase. As far as I can tell, it only happens when extending PDO. As a side-note, I have seen several issues with __call() and PDO.. is there anything special about PDO which could explain that ? Reproduce code: --------------- class A extends PDO { function __call($m, $p) {print __CLASS__."::$m\n";} } class B extends XSLTProcessor { function __call($m, $p) {print __CLASS__."::$m\n";} } $a = new A('sqlite:dummy.db'); $a->truc(); $a->TRUC(); $b = new B(); $b->truc(); $b->TRUC(); Expected result: ---------------- A::truc A::TRUC <----------- B::truc B::TRUC Actual result: -------------- A::truc A::truc <----------- B::truc B::TRUC ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46542&edit=1

« previous php.bugs (#130894) next »