From:             greg at chiaraquartet dot net
Operating system: linux
PHP version:      5.0.0b1 (beta1)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  protected data member redeclared as public

Description:
------------
if a protected data member is re-declared as public in a child class, it
is redefined as public.  Shouldn't the parent class protected declaration
override the child class as it does for private?

Reproduce code:
---------------
<?php
class test
{
        protected $a = 6;
        function __construct()
        {
                print $this->a;
        }
}

class my extends test
{
        var $a = 7;
        function __construct()
        {
                print $this->a;
                parent::__construct();
        }
}
$a = new test; // 6
$a = new my; // 77
print $a->a; // should give error, is 7
$a->a = 4;
print $a->a; // 4
?>

Expected result:
----------------
Fatal Error, cannot redeclare a protected data member as public

Actual result:
--------------
67774

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

Reply via email to