ID: 46594 Updated by: [EMAIL PROTECTED] Reported By: dckorah at gmail dot com Status: Open Bug Type: Class/Object related Operating System: Linux (Ububtu 7.10) PHP Version: 5.2.6 New Comment:
Actually this has nothing to do with __construct(), same happens with "regular" methods too. Previous Comments: ------------------------------------------------------------------------ [2008-11-17 14:04:31] dckorah at gmail dot com Description: ------------ <?php class A { function __construct() { $this->a_property = 'property set from A'; } } class B { function __construct() { A::__construct(); $this->b_property = 'property set from B'; } } ?> In the above code, if you initialise class B and inspect the properties of it, you will see that both a_property and b_property are set. This is quite unexpected from an OO language. version info: PHP 5.2.3-1ubuntu6.4 (cli) (built: Jul 23 2008 06:20:35) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies Reproduce code: --------------- <?php class A { function __construct() { $this->a_property = 'property set from A'; } } class B { function __construct() { A::__construct(); $this->b_property = 'property set from B'; } } ?> Expected result: ---------------- Class A has got nothing to do with class B and this should not happen. If at all an user trys this, it should throw an error. Actual result: -------------- Please see description. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46594&edit=1