php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22269 Inherited Classes ignore initalization-value of inherites Variables
Submitted: 2003-02-18 03:49 UTC Modified: 2003-04-27 06:56 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: White_Angel at gmx dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-02-18 (dev) OS: Linux;RedHat8.0;2.4.18-24
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: White_Angel at gmx dot de
New email:
PHP Version: OS:

 

 [2003-02-18 03:49 UTC] White_Angel at gmx dot de
And Again:
Inherited Classes ignore initalization-value of inherites Variables

Clean CVS checkout.
default configure & make ....
The Following Test Fail.
(Checked on 2 Systems. SMP & !SMP)
--TEST--
Classes inheritance test
--POST--
--GET--
--FILE--
<?php

/* Inheritance test2. Inherited Vars  */

class foo {
  var $a="Content A";
  function display() {
    echo "This is class foo\n";
    echo "a = ".$this->a."\n";
  }
};

class bar extends foo {
  function display() {  /* alternative display function for class bar */
    echo "This is class bar\n";
    echo "a = ".$this->a."\n";
  }
};


$foo1 = new foo;
$foo1->display();
$bar1 = new bar;
$bar1->display();
--EXPECT--
This is class foo
a = Content A
This is class bar
a = Content A

--- Im getting
This is class foo
a = Content A
This is class bar
a = 


PS: If i make a mistake. This Info is welcome to me too.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-18 22:49 UTC] sniper@php.net
Is this PHP 5-dev related only?

 [2003-02-19 01:16 UTC] White_Angel at gmx dot de
Yes. it Seems.
 [2003-04-19 10:56 UTC] thekid at thekid dot de
Cannot reproduce with latest CVS:

thekid@friebes:~/devel/php/tests > cat bug22269.php
<?php
class foo {
  var $a="Content A";
  function display() {
    echo "This is class foo\n";
    echo "a = ".$this->a."\n";
  }
};

class bar extends foo {
  function display() {
    echo "This is class bar\n";
    echo "a = ".$this->a."\n";
  }
};

$foo1 = new foo;
$foo1->display();
$bar1 = new bar;
$bar1->display();
?>
thekid@friebes:~/devel/php/tests > php5 bug22269.php 
This is class foo
a = Content A
This is class bar
a = Content A
 [2003-04-27 06:56 UTC] White_Angel at gmx dot de
Bug dissapeared in Actual CVS.
Thank You.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 22:01:26 2024 UTC