php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #44448 base class constructor will remain unaffected by calling an successor obj.
Submitted: 2008-03-16 17:26 UTC Modified: 2014-12-30 10:41 UTC
From: office at bas-x dot de Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5.2.5 OS: Windows XP
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: office at bas-x dot de
New email:
PHP Version: OS:

 

 [2008-03-16 17:26 UTC] office at bas-x dot de
Description:
------------
Obviously, the constructor of a base class will remain unaffected when calling an successor object.
It should be a very essential feature.
Because, also base classes maybe needs private initiations.


Reproduce code:
---------------
Class Base
{
    private $test;
    function __construct ( $moduleData ) 
    {              
       $test = "Hello World";
    }
}

Class Successor extends Base
{
      echo $this->test;
}





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-11-02 01:14 UTC] requinix@php.net
-Status: Open +Status: Feedback -Package: Feature/Change Request +Package: *General Issues
 [2014-11-02 01:14 UTC] requinix@php.net
I can't figure out what this is trying to ask for. Parent constructor isn't called if the child doesn't call it explicitly? Yes it is. Can't access $this->test in the child? Correct because it's a private property of the parent.
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 03:01:32 2024 UTC