|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-10-13 04:49 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 21:00:02 2025 UTC | 
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