#21008 [Com]: When initialising an undeclared instance variable no error is shown
| From: | jan_willem_maarse at hotmail dot com | Date: | Sat, 14 Dec 2002 12:09:41 +0000 |
| Subject: | #21008 [Com]: When initialising an undeclared instance variable no error is shown | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27693@lists.php.net to get a copy of this message | ||
ID: 21008
Comment by: jan_willem_maarse@hotmail.com
Reported By: jan_willem_maarse@hotmail.com
Status: Won\'t fix
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.2.3
New Comment:
hmm... when is php going to support OO then? They say OO programming is
supported, but I have my thoughts about this.
Previous Comments:
------------------------------------------------------------------------
[2002-12-14 06:07:00] derick@php.net
Not a bug at all, you don't need to declare any variable in PHP,
nowhere. Adding an error for this will break tons of scripts, so we're
not going to add it.
------------------------------------------------------------------------
[2002-12-14 06:03:29] jan_willem_maarse@hotmail.com
When I call a method that initializes a instance variable that isn't
declared, php doen's complain. I see this as a bug, because when I
mis-spelled an instance variabele some strange things happen. Because
when I trie to get the value of an instance variabele, I get the
old/unitialized value.
Here is some sample code:
<?
class apple
{
var $color;
function fruit($new_color) {
$this->color = $new_color;
}
function set_taste($new_taste) {
$this->taste = $new_taste;
}
}
$green_apple = new apple('green');
$green_apple->set_taste('good');
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21008&edit=1