ID: 25199
Comment by: kyle at putnamcabinets dot com
Reported By: thomas dot hebinck at digionline dot de
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Linux
PHP Version: 5CVS-2003-08-21 (dev)
New Comment:
Interesting phenomenon:
<?
class foo
{
//var $a; // When uncommented, bug always occurs
function __get($property)
{
echo "I behave properly\n";
}
}
$a = new foo;
//$a->a = 'x'; // When uncommented, bug always occurs
echo $a->a;
?>
No output indicates the bug occurs, otherwise output is "I behave
properly".
Previous Comments:
------------------------------------------------------------------------
[2003-08-21 13:05:24] thomas dot hebinck at digionline dot de
Description:
------------
A call of $this->a creates a new public variable instead of calling
__get('a') - even if this call is just defined and never used. (same
problem in beta 1)
Reproduce code:
---------------
<?
class foo {
function __get($property) {
switch ($property) {
case 'a':
return 'a';
break;
}
}
function bar() {
echo 'test';
return $this->a; // this is the "bad" line
}
}
$foo = new foo;
echo '$foo->a = "' . $foo->a . '"';
?>
Expected result:
----------------
$foo->a = "a"
Actual result:
--------------
$foo->a = ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25199&edit=1