#34936 [NEW]: Base methods influenced by masking in derived classes

From: Date: Thu, 20 Oct 2005 17:36:36 +0000
Subject: #34936 [NEW]: Base methods influenced by masking in derived classes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-86827@lists.php.net to get a copy of this message
From: pa-engineer at web dot de Operating system: WinXP PHP version: 5.0.5 PHP Bug Type: Class/Object related Bug description: Base methods influenced by masking in derived classes Description: ------------ Dieser Effekt hat weitreichende Konsequenzen für die Funktionstüchtigkeit von Methoden die wiederum Methoden desselben Objektes aufrufen, die unter dem Einfluss der Ableitung modifiziert werden könnten. Anstelle dessen: Basismethoden rufen auch Basismethoden auf, unberührt von einer Verdeckung durch eine abgeleitete Klasse. This Effect has a wide range of consequences in functionality of base methods whitch call methods of the same object, perhaps influenced by using modifikation in derived classes. Instead: base methods simply call base methods, untoughed by using a mask in derived classes. Reproduce code: --------------- class Class_A { public function Do_Something() { $this->Class_A_Method(); } public function Class_A_Method() { echo "Class_A"; } } class Class_B extends Class_A { public function Class_A_Method() { echo "Class_B"; } } $Instance = new Class_B(); $Instance->Do_Something(); Expected result: ---------------- Die Ausgabe hier ist offensichtlich "Class_B". Meine Erwartung, wie auch in anderen Sprachen: "Class_A". The Output in this case here is obviously "Class_B" My expectation, such as in other languages: "Class_A". -- Edit bug report at http://bugs.php.net/?id=34936&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34936&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34936&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34936&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34936&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34936&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34936&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34936&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34936&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34936&r=support Expected behavior: http://bugs.php.net/fix.php?id=34936&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34936&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34936&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34936&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34936&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34936&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34936&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34936&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34936&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34936&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34936&r=mysqlcfg

« previous php.bugs (#86827) next »