php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30704 duplicate properties
Submitted: 2004-11-06 17:06 UTC Modified: 2004-11-06 17:08 UTC
From: info at rhalff dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.2 OS: Linux
Private report: No CVE-ID: None
 [2004-11-06 17:06 UTC] info at rhalff dot com
Description:
------------
Property is declared twice, see below..

Reproduce code:
---------------
<?php

abstract class Base {

        private $var;

        function __construct()
        {
            $this->initAttributes();
            $this->doit();
        }

        final private function initAttributes( )
        {
                $this->var = false;
        }

        abstract protected function doit();


}

class Ext extends Base {

        protected function doit()
        {
          $this->var = 1;
        }

}

class Bla {

        static private $instance = false;

        static function instance() {
                Bla::$instance = new Ext();
                return Bla::$instance;
        }

}

$bla = Bla::instance();
var_dump($bla);
?>

Expected result:
----------------
object(Ext)#1 (2) {
  ["var:private"]=>
  int(1)
}


Actual result:
--------------
object(Ext)#1 (2) {
  ["var:private"]=>
  bool(false)
  ["var"]=>
  int(1)
}


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-06 17:08 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Aug 16 11:01:27 2024 UTC