#28240 [Com]: class member assigment without declaration defines new member
| From: | phpbug at gb404 dot com | Date: | Tue, 04 May 2004 03:51:31 +0000 |
| Subject: | #28240 [Com]: class member assigment without declaration defines new member | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59185@lists.php.net to get a copy of this message | ||
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