#22214 [Com]: On Class Extend Class no Vars are inherite

From: Date: Fri, 18 Apr 2003 23:06:43 +0000
Subject: #22214 [Com]: On Class Extend Class no Vars are inherite
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37876@lists.php.net to get a copy of this message
ID: 22214 Comment by: thekid at thekid dot de Reported By: White_Angel at gmx dot de Status: Open Bug Type: Zend Engine 2 problem Operating System: Linux PHP Version: 5CVS-2003-02-13 (dev) New Comment: Can't reproduce this here either: thekid@friebes:~ > cat | php5 <?php class test1 { var $t1 = "This is a simple Variable"; function b() { echo "test1:b Content of t1:".$this->t1."\n"; } } class test2 extends test1 { function a() { echo "test2:a Content of t1:".$this->t1."\n"; } } $a = new test1; $a->b(); $a = new test2; $a->a(); $a->b(); ?> test1:b Content of t1:This is a simple Variable test2:a Content of t1:This is a simple Variable test1:b Content of t1:This is a simple Variable Previous Comments: ------------------------------------------------------------------------ [2003-02-17 13:19:09] White_Angel at gmx dot de hm. If you dont have an Access to the var $t1 in the test2 class. in runs...(the inherited method from class1 habe the var) the accesing method of class2 don't must be called. ------------------------------------------------------------------------ [2003-02-13 17:13:02] White_Angel at gmx dot de still exists. ------------------------------------------------------------------------ [2003-02-13 16:56:16] White_Angel at gmx dot de /usr/local/php5/bin/php -v PHP 5.0.0-dev (cgi), Copyright (c) 1997-2003 The PHP Group Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies [root@app-server php5]# /usr/local/php5/bin/php /home/white/phptest/varbug.php Content-type: text/html X-Powered-By: PHP/5.0.0-dev test1:b Content of t1:This is a simple Variable test2:a Content of t1: test1:b Content of t1: [root@app-server php5]# What is my Failure ? New CLean cvs checkout of Module php5. buidlconf configure --prefix make make install ------------------------------------------------------------------------ [2003-02-13 16:52:56] White_Angel at gmx dot de PS: other thing, where i thougt it's was my fault. var $test="aaa" $a="test" $this->$test in an class file in an etxra php file. my php was killen with an segfault when this file was included. (No instance of this class exists -> only include) ------------------------------------------------------------------------ [2003-02-13 16:52:09] nicos@php.net It has just been documented then. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/22214 -- Edit this bug report at http://bugs.php.net/?id=22214&edit=1

« previous php.bugs (#37876) next »