PHP 4.0 Bug #5038: Script fails if declaring class method like : function foo($this->SomeVar) { }
| From: | juhl at eisenstein dot dk | Date: | Wed, 14 Jun 2000 20:13:44 +0000 |
| Subject: | PHP 4.0 Bug #5038: Script fails if declaring class method like : function foo($this->SomeVar) { } | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-21331@lists.php.net to get a copy of this message | ||
From: juhl@eisenstein.dk
Operating system: Linux
PHP version: 4.0.0 Release
PHP Bug Type: Misbehaving function
Bug description: Script fails if declaring class method like : function foo($this->SomeVar)
{ }
If I declare a class like this:
class foo
{
var $SomeVar;
function foo($this->SomeVar)
{
}
}
I get parse errors at run time, but If I do like this:
class foo
{
var $SomeVar;
function foo($SomeVar)
{
$this->SomeVar = $SomeVar;
}
}
Then it runs fine and $this->SomeVar contain whatever was parsed to the method.
IMO this is wrong. I think it should be possible to declare a class as per the first example and
then have whatever is passed to the constructor method be placed in $this->SomeVar (actually the
book "Professional PHP Programming" from WROX documents classes as behaving that way).
I hope this is a bug, and that it will get fixed ;-) If it's not considered a bug, then please
reassign this bug-report to the feature-request category.
Best regards
Jesper Juhl
juhl@eisenstein.dk