#36411 [Opn->Bgs]: name of parameter in static method
| From: | derick@php.net | Date: | Thu, 16 Feb 2006 08:42:01 +0000 |
| Subject: | #36411 [Opn->Bgs]: name of parameter in static method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93317@lists.php.net to get a copy of this message | ||
ID: 36411
Updated by: derick@php.net
Reported By: Sm0ke999 at yandex dot ru
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Win xp
PHP Version: 5.1.2
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Because "$this" has a special meaning in PHP.
Previous Comments:
------------------------------------------------------------------------
[2006-02-16 09:39:53] Sm0ke999 at yandex dot ru
Description:
------------
Why in "static method" name of "parameter" can not be "$this" ?
Reproduce code:
---------------
<?php
header("Content-Type: text/plain; charset=koi8-r");
class Base
{
public $x= 'x', $y= 'y';
public static function fnTest($this)
{
echo __CLASS__,'::',__FUNCTION__,"()\t",get_class($this),"\n";
list($this->x, $this->y)= array($this->y, $this->x);
print_r($this);
}
}
$o= new Base;
Base::fnTest($o);
?>
Expected result:
----------------
Base::fnTest()Base
Base Object
(
[x] => y
[y] => x
)
Actual result:
--------------
[Thu Feb 16 11:31:32 2006] [error] [client 192.168.0.250] PHP Fatal
error: Using $this when not in object context in
D:\\dev\\Site\\test.htm on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36411&edit=1