Annotation of embedaddon/php/Zend/tests/bug41961.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #41961 (Ensure search for hidden private methods does not stray from class hierarchy)
                      3: --FILE--
                      4: <?php
                      5: X::test();
                      6:  
                      7: /** Class X is related to neither ParentClass nor ChildClass. */
                      8: class X {
                      9:   public static function test() {
                     10:     $myChild = new ChildClass;  
                     11:     $myChild->secret(); // bug - invokes X::secret() instead of ChildClass::secret()
                     12:   }
                     13:   private function secret() {
                     14:     echo "Called private " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
                     15:   } 
                     16: }
                     17:  
                     18: class ParentClass { 
                     19:   private function secret() { }
                     20: }
                     21:  
                     22: class ChildClass extends ParentClass {
                     23:   public function secret() {
                     24:     echo "Called public " . __METHOD__ . "() on an instance of: " . get_class($this) . "\n";
                     25:   } 
                     26: }
                     27: ?>
                     28: --EXPECT--
                     29: Called public ChildClass::secret() on an instance of: ChildClass

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>