php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22214 On Class Extend Class no Vars are inherite
Submitted: 2003-02-13 16:00 UTC Modified: 2003-04-27 06:55 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: White_Angel at gmx dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-02-13 (dev) OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: White_Angel at gmx dot de
New email:
PHP Version: OS:

 

 [2003-02-13 16:00 UTC] White_Angel at gmx dot de
To Reproduce call the following code:
<?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();

php?>

In My opinnion the Text must be printet 3 times..
But only in the first Method it will be printed. In the class test2 it is empty --> not declared ...

It this a Bug or a feature ?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-13 16:06 UTC] nicos@php.net
I can't reproduce this with ZE2, it works just fine...

Output:

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

Which is just nice.

Are you sure you are using latest CVS?


 [2003-02-13 16:09 UTC] White_Angel at gmx dot de
Yes. updated 5 minutes ago.
I Will checkout my sources new... perhaps...
 [2003-02-13 16:14 UTC] nicos@php.net
Be sure you use the correct binary (if you use CLI) with ZE2 and tell us.

(php -v might help in that case)

Thank you.
 [2003-02-13 16:38 UTC] White_Angel at gmx dot de
- recheckout CVS source (php & Zend2)
- check right bianry: is OK.
- have disabled all uneeded Modules
My Configure String:
./configure \
--with-pgsql \
--without-mysql \
--prefix=/usr/local/php5 \
--enable-sockets \
--enable-bcmath \
--enable-dbase \
--enable-dbx \
--enable-ftp \
--enable-dio \
--enable-dbx \
--enable-gd-native-ttf \
--with-zlib \
--with-bz2 \
--with-gmp \
--with-readline \
--enable-embed \
--with-apxs2 \
--with-pspell
# --enable-license
# --enable-pcntl \
# --disable-overload \
# --enable-exif \
My Output:
/usr/local/php5/bin/php varbug.php
test1:b Content of t1:This is a simple Variable
test2:a Content of t1:
test1:b Content of t1:
My php -v :
/usr/local/php5/bin/php -v
PHP 5.0.0-dev (cli) (built: Feb 13 2003 22:34:16)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies

The Next try with
./configure
PHP 5.0.0-dev (cli) (built: Feb 13 2003 23:39:03)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies
The Same.

php -i
 sapi/cli/php -i
phpinfo()
PHP Version => 5.0.0-dev

System => Linux app-server.inter-data.prv 2.4.18-17.8.0smp-appserver #1 SMP Die Okt 22 09:48:23 CEST 2002 i686
Build Date => Feb 13 2003 23:38:01
Configure Command =>  './configure'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/lib
PHP API => 20020918
PHP Extension => 20020429
Zend Extension => 90021012
Debug Build => no
Thread Safety => disabled
Registered PHP Streams => php, http, ftp


This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies


Do You need More Infos ?
What should i try at next ?
 [2003-02-13 16:43 UTC] White_Angel at gmx dot de
UPS. there is a PHP5 Module in CVS ?
That's new or ? :)
 [2003-02-13 16:48 UTC] nicos@php.net
Yes thats new and not documented. Did it worked with php5 module?
 [2003-02-13 16:50 UTC] White_Angel at gmx dot de
It's compiling right now.
(it's documentt on your anonymous CVS How to Page 
http://www.php.net/anoncvs.php)
 [2003-02-13 16:52 UTC] nicos@php.net
It has just been documented then.
 [2003-02-13 16:52 UTC] 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:56 UTC] 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 17:13 UTC] White_Angel at gmx dot de
still exists.
 [2003-02-17 13:19 UTC] 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-04-18 18:06 UTC] thekid at thekid dot de
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
 [2003-04-27 06:55 UTC] White_Angel at gmx dot de
Dissapeard in Actual CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 16:01:27 2024 UTC