#44425 [Opn->Csd]: Extending PDO/MySQL class with a __call() function doesn't work

From: Date: Thu, 13 Mar 2008 16:10:44 +0000
Subject: #44425 [Opn->Csd]: Extending PDO/MySQL class with a __call() function doesn't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123291@lists.php.net to get a copy of this message
 ID:               44425
 Updated by:       iliaa@php.net
 Reported By:      phpbugs at wayoverthere dot com
-Status:           Open
+Status:           Closed
 Bug Type:         PDO related
 Operating System: Linux
 PHP Version:      5.2CVS-2008-03-13 (snap)
 New Comment:

Works fine in snapshot and PHP 5.3


Previous Comments:
------------------------------------------------------------------------

[2008-03-13 04:52:06] phpbugs at wayoverthere dot com

Description:
------------
Exact(?) same bug as #43663, except connecting to a MySQL 5 server. I 
have also tried a 5.3 snapshot & got the same result. Tried both cgi 
and cli.


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('mysql:dbname=test;host=localhost','user','pw');
$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=44425&edit=1



Thread (7 messages)

« previous php.bugs (#123291) next »