From:             agigames at agigames dot com
Operating system: Windows XP
PHP version:      5.0.0b4 (beta4)
PHP Bug Type:     Class/Object related
Bug description:  Extends and parent vars

Description:
------------
This problem occurs in both PHP 4.3.5RC3 and in PHP 5.0.0b4. The
constructor function of the child class does not have the proper var's set
in it from the parent class.

Reproduce code:
---------------
class parentclass {

        public $var = 'test';



        function parentclass() {

                $this->var = 'test2';

        }

}



class childclass extends parentclass {

        function childclass() {

                print $this->var;

        }

}



$obj = new parentclass;

$obj2 = new childclass;

Expected result:
----------------
Well I expected it to print "test2".

Actual result:
--------------
But instead it prints the value that the public var was initialized as
"test".

-- 
Edit bug report at http://bugs.php.net/?id=27476&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27476&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27476&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27476&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27476&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27476&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27476&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27476&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27476&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27476&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27476&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27476&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27476&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27476&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27476&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27476&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27476&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27476&r=float

Reply via email to