ID: 28240
Comment by: phpbug at gb404 dot com
Reported By: php at jort dot net
Status: Open
Bug Type: Class/Object related
Operating System: Win2000 Pro
PHP Version: 5.0.0RC2
New Comment:
It is totally normal.
As far as I can remember, PHP never needed to declare a variable before
using it.
Previous Comments:
------------------------------------------------------------------------
[2004-04-30 22:30:09] php at jort dot net
Description:
------------
When you assign a value to a class member that was not declared the
system defines a new class member.
I'm not sure this is a feature or a bug.
I would expect an error or at least a notice or a warning.
Reproduce code:
---------------
<?php
class foo {
function __construct() {
$this->foo = "test";
}
}
$bar = new foo();
print $bar->foo;
?>
Expected result:
----------------
Notice/Warning/Error
Actual result:
--------------
test
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28240&edit=1