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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 + 45 = ?
Subscribe to this entry?

 
 [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: Sat May 18 03:02:51 2024 UTC