#36586 [Opn->Bgs]: undefined $this in member function default parameter value

From: Date: Thu, 02 Mar 2006 07:44:58 +0000
Subject: #36586 [Opn->Bgs]: undefined $this in member function default parameter value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93825@lists.php.net to get a copy of this message
ID: 36586 Updated by: tony2001@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. Syntax error is syntax error, that's exactly what you got. And $this is a reserved word. Previous Comments: ------------------------------------------------------------------------ [2006-03-02 08:30:57] Sm0ke999 at yandex dot ru Description: ------------ //undefined $this in member function default parameter value class Test { public function fnTest($that= $this) { echo __CLASS__, "::", __FUNCTION__, "\t that: ", gettype($that), "\n"; } } Reproduce code: --------------- class Test { public function fnTest($that= $this) { echo __CLASS__, "::", __FUNCTION__, "\t that: ", gettype($that), "\n"; } } Expected result: ---------------- Test::fnTest that: Object Actual result: -------------- [Thu Mar 02 10:19:34 2006] [error] PHP Parse error: syntax error, unexpected T_VARIABLE in D:\\dev\\Site\\multipleinheritance.htm on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36586&edit=1

« previous php.bugs (#93825) next »