#34847 [Opn->Bgs]: Overloading __call() does nothing on an extended class

From: Date: Thu, 13 Oct 2005 03:25:32 +0000
Subject: #34847 [Opn->Bgs]: Overloading __call() does nothing on an extended class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86495@lists.php.net to get a copy of this message
ID: 34847 User updated by: junk at thinkof dot net Reported By: junk at thinkof dot net -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: OSX 10.4.2 PHP Version: 5.0.5 New Comment: I was reading this wrong. This is my bad, sorry all. Previous Comments: ------------------------------------------------------------------------ [2005-10-13 04:52:15] junk at thinkof dot net Sorry, the reproduce code got scrambled a bit. It should be: <?php class b { function blah (){ print "In method: blah"; } } class a extends b { function __call ($method, $args){ print '__call(): '.$method; } } $test = new a (); $test->blah (); ?> Expected result: ---------------- __call():blah In method: blah Actual result: -------------- In method: blah ------------------------------------------------------------------------ [2005-10-13 04:49:39] junk at thinkof dot net Description: ------------ Overloading the function __call() results in __call() not be executed when a class is extended. Having the __call() overload in the parent, child or both makes no difference. Reproduce code: --------------- <?php class extendable { function blah (){ print 'blah'; } } class extendee extends extendable { function __call ($method, $args){ print $method; } } $test = new extendee (); $test->blah (); ?> <?php class extendable { function __call ($method, $args){ print $method; } function blah (){ print 'blah'; } } class extendee extends extendable { } $test = new extendee (); $test->blah (); ?> <?php class b { function blah (){ print "In method: blah"; } } class a extends b { function __call ($method, $args){ print '__call(): '.$method; } } $test = new a (); $test->blah (); ?> Expected result: ---------------- __call():blah In method: blah Actual result: -------------- In method: blah ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34847&edit=1

« previous php.bugs (#86495) next »