php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34847 Overloading __call() does nothing on an extended class
Submitted: 2005-10-13 04:49 UTC Modified: 2005-10-13 05:25 UTC
From: junk at thinkof dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.5 OS: OSX 10.4.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: junk at thinkof dot net
New email:
PHP Version: OS:

 

 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-13 04:52 UTC] 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 05:25 UTC] junk at thinkof dot net
I was reading this wrong.  This is my bad, sorry all.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 15:01:36 2025 UTC