ID: 41162 User updated by: bugs dot php dot net dot nsp at cvogt dot org Reported By: bugs dot php dot net dot nsp at cvogt dot org Status: Bogus Bug Type: Class/Object related Operating System: Windows XP Professional SP2 PHP Version: 5.2.1 New Comment:
Thank you for the quick reply and the proposed generic function body. What do you mean by "You would be missing two completely different things, descriptive and non descriptive semantic elements."? I could use function <name>(<signature>) { $args = func_get_args(); return $this->__call(__FUNCTION__, $args); } (which fixes 2 bugs in your suggestion) but I would prefer an abstraction over copy&paste. Previous Comments: ------------------------------------------------------------------------ [2007-04-22 13:21:55] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You would be missing two completely different things, descriptive and non descriptive semantic elements. What you can do is providing the implementation of the interface methods all with the same body: function <name>(<signature>) { return $this->__call(array($this, __FUNCTION__), func_get_args()); } where <name> and <signature> have to be replaced with the method name in question and its parameters respectively. ------------------------------------------------------------------------ [2007-04-22 13:11:39] bugs dot php dot net dot nsp at cvogt dot org Description: ------------ When implementing an interface one cannot use __call to implement methods as this will lead to a FATAL ERROR. However it would be quite convenient if one could do this. It would e.g. allow to generically pass on method calls to an object that is stored in a local variable and implements the interface. Reproduce code: --------------- interface MyInterface{ public function myMethod(); } class MyImplementation implements MyInterface{ public function __call( $method, $parameters ){ // do something } } Expected result: ---------------- __call takes care of not explicitly implemented methods declared in MyInterface. Actual result: -------------- Fatal error: Class MyImplementation contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (MyInterface::myMethod) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41162&edit=1