#25187 [Opn->Bgs]: Call of __get in a construtor does not work
| From: | sniper@php.net | Date: | Sat, 29 Nov 2003 01:50:48 +0000 |
| Subject: | #25187 [Opn->Bgs]: Call of __get in a construtor does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51279@lists.php.net to get a copy of this message | ||
ID: 25187
Updated by: sniper@php.net
Reported By: thomas dot hebinck at digionline dot de
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 5.0.0b1 (beta1)
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
..
Previous Comments:
------------------------------------------------------------------------
[2003-08-21 06:37:45] thomas dot hebinck at digionline dot de
Description:
------------
The call of a property via __get from a constructor called the same way
does not work.
- $m is created
- $m->s creates new class s (via m::__get)
- the constructor of s calls $m->d->d_test
- m::_get (for $m->d) is NOT called:
Notice: Undefined property
See the source - it should make it clear ;-)
Reproduce code:
---------------
class d {
public function d_test() {
return true;
}
}
class s {
function __construct() {
global $m;
$m->d->d_test();
}
function s_test() {
}
}
class m {
function __get($property) {
switch ($property) {
case 'd':
return new d;
break;
case 's':
return new s;
break;
}
}
}
$m=new m;
$m->s->s_test();
Expected result:
----------------
just nothing - there is no output to reduce the lines of source code.
Actual result:
--------------
Notice: Undefined property: m::$d in /www/w23_bug/test_bug.php on line
10
Fatal error: Call to a member function d_test() on a non-object in
/www/w23_bug/test_bug.php on line 10
This is the line: $m->d->d_test();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25187&edit=1