#34198 [Opn->Bgs]: Class Member Visibility
| From: | helly@php.net | Date: | Sun, 21 Aug 2005 11:37:15 +0000 |
| Subject: | #34198 [Opn->Bgs]: Class Member Visibility | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83847@lists.php.net to get a copy of this message | ||
ID: 34198
Updated by: helly@php.net
Reported By: kuprishuz at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: *
PHP Version: 5.1.0RC1
New Comment:
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
Please submit the code that outputs anything!
Now look at this:
<?php
//class error
//{
//}
class system
{
public $errorobj;
public $databaseobj;
function __construct()
{
$this->errorobj = new error($this);
$this->databaseobj = new database($this);
}
}
class database
{
function __construct($system)
{
$this->system = $system;
var_dump(get_class($this->system->errorobj));
}
}
new database(new system());
?>
marcus@zaphod /usr/src/php-cvs $ php ~/tmp/bug34198.php
make: `sapi/cli/php' is up to date.
Fatal error: Class 'error' not found in /home/marcus/tmp/bug34198.php
on line 13
marcus@zaphod /usr/src/php-cvs $
When i enable the commented code, e.g. provide a class error:
marcus@zaphod /usr/src/php-cvs $ php ~/tmp/bug34198.php
make: `sapi/cli/php' is up to date.
string(5) "error"
string(5) "error"
So you have an error anywhere else or in your design.
Previous Comments:
------------------------------------------------------------------------
[2005-08-20 20:54:35] kuprishuz at gmail dot com
Description:
------------
appears to be problems with class member variable visibility causing
application to be completely un-useable, i have also attempted to echo
member variables in the same method but they are always blank.
Reproduce code:
---------------
class system {
public $errorobj;
public $databaseobj;
function __construct() {
$this->errorobj = new error($this);
$this->databaseobj = new database($this);
}
}
class database {
function __construct($system) {
$this->system = $system;
get_class($this->system->errorobj);
}
}
Expected result:
----------------
should return the object name "error"
Actual result:
--------------
returns "non-object" error message
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34198&edit=1