ID:               41623
 Updated by:       [EMAIL PROTECTED]
 Reported By:      amine dot abbes at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: windows XP
 PHP Version:      5.2.3
 New Comment:

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




Previous Comments:
------------------------------------------------------------------------

[2007-06-07 10:14:58] amine dot abbes at gmail dot com

Description:
------------
When calling parent::__construct() in the subclass constructor, $this
will refere to the subclass instance.

Reproduce code:
---------------
<?php
 class MyParent{
        function __construct(){
                echo (($this instanceof MyClass)?"Yes":"No") . "<br>" ;
                self::myfunction();
                $this->myfunction();
        }
        
        function myfunction(){
                echo __METHOD__ . "<br>";
        }
        
}

class MyClass extends MyParent{
        
        function __construct(){
                parent::__construct();
        }
        
        function myfunction(){
                echo __METHOD__ . "<br>";
        }
        
}

new MyClass();
?>

Expected result:
----------------
No
MyParent::myfunction
MyParent::myfunction

Actual result:
--------------
Yes
MyParent::myfunction
MyClass::myfunction


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=41623&edit=1

Reply via email to