#38497 [Bgs]: Overloading does not work with extended classes (__call() never called)
ID: 38497
User updated by: alessio dot bazzica at gmail dot com
Reported By: alessio dot bazzica at gmail dot com
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Mac OS X
PHP Version: 5.1.5
New Comment:
Ok, thank you for the support. Since in other languages (such
as C++ or Java) it's possible to overload a defined parent
class method, I'm proposing to emphasize the fact that in PHP
there is no way to do this kind of overload (eventually you
could add this notice in language.oop5.overloading.html).
Previous Comments:
------------------------------------------------------------------------
[2006-09-16 07:58:06] johannes@php.net
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
__call() is only called for undefined methods, DoSomething() is defined
in your class.
------------------------------------------------------------------------
[2006-09-15 09:30:27] alessio dot bazzica at gmail dot com
Sorry, maybe I didn't explain the problem clearly. Sure
child classes inherit parent's methods but my problem is
another. I need to overload ParentClass::DoSomething() so I
defined ChildClass::__call($method, $args) to call
ChildClass::DoSomething_OVERLOAD() instead of
ChildClass::DoSomething() (if $method is 'DoSomething'). It
seems that PHP invoke DoSomething() before __call() on child
class. In this case it is ALWAYS impossible to overload a
parent method. My question is: "PHP denies parent method
overloading or this could be a bug???". Thank you, Alessio
------------------------------------------------------------------------
[2006-09-14 20:52:05] tony2001@php.net
Childs DO inherit parent's methods.
No bug here, this is expected and well documented.
------------------------------------------------------------------------
[2006-09-14 20:31:49] alessio dot bazzica at gmail dot com
Please download a zip file containing my test case script at
http://webapp.altervista.org/php_ovrldext_test.zip.
Recently I
tried to run the script on other enviroments and there is the
same problem. Thank you, Alessio
------------------------------------------------------------------------
[2006-08-29 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/38497
--
Edit this bug report at http://bugs.php.net/?id=38497&edit=1
Thread (7 messages)