#36586 [NEW]: undefined $this in member function default parameter value

From: Date: Thu, 02 Mar 2006 07:31:01 +0000
Subject: #36586 [NEW]: undefined $this in member function default parameter value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93821@lists.php.net to get a copy of this message
From: Sm0ke999 at yandex dot ru Operating system: win xp PHP version: 5.1.2 PHP Bug Type: Class/Object related Bug description: undefined $this in member function default parameter value 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 bug report at http://bugs.php.net/?id=36586&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36586&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36586&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36586&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36586&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36586&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36586&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36586&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36586&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36586&r=support Expected behavior: http://bugs.php.net/fix.php?id=36586&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36586&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36586&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36586&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36586&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36586&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36586&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36586&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36586&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36586&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36586&r=mysqlcfg

« previous php.bugs (#93821) next »