php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25441 public properties of parent class not accessible
Submitted: 2003-09-08 18:21 UTC Modified: 2003-11-18 16:59 UTC
From: tater at potatoe dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-09-08 (dev) OS: OS X 10.2
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: tater at potatoe dot com
New email:
PHP Version: OS:

 

 [2003-09-08 18:21 UTC] tater at potatoe dot com
Description:
------------
If a child class directly references a property defined in
the parent class, it no longer inherits it.

Reproduce code:
---------------
<?php
class base { public $x = 1; }
class foo extends base { }
class bar extends base
{
    public function bartest()
    {
        var_dump($this->x);
    }
}
$base = new base;
print_r($base);
$foo = new foo;
print_r($foo);
$bar = new bar;
print_r($bar);
$bar->bartest();
?>

Expected result:
----------------
base Object
(
    [x] => 1
)
foo Object
(
    [x] => 1
)
bar Object
(
    [x] => 1
)
int(1)

Actual result:
--------------
base Object
(
    [x] => 1
)
foo Object
(
    [x] => 1
)
bar Object
(
)

Notice: Undefined property:  bar::$x in /path/bug.php on line 12
NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-18 16:59 UTC] sniper@php.net
Works as expected with latest CVS. Seems to be fixed..

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 19 14:00:02 2025 UTC