From: Sm0ke999 at yandex dot ru
Operating system: Win xp
PHP version: 5.1.2
PHP Bug Type: Class/Object related
Bug description: name of parameter in static method
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 bug report at http://bugs.php.net/?id=36411&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36411&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36411&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36411&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36411&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36411&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36411&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36411&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36411&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36411&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36411&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36411&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36411&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36411&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36411&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36411&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36411&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36411&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36411&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36411&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36411&r=mysqlcfg