Bug #66199 [Nab]: Access to undeclared static property: static::$this

From: Date: Fri, 29 Nov 2013 14:14:27 +0000
Subject: Bug #66199 [Nab]: Access to undeclared static property: static::$this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183011@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66199&edit=1 ID: 66199 Updated by: bwoebi@php.net Reported by: gulturyan at gmail dot com Summary: Access to undeclared static property: static::$this Status: Not a bug Type: Bug Package: *General Issues Operating System: Ubuntu 12.04 PHP Version: 5.4.22 Block user comment: N Private report: N New Comment: That static::$this worked was a bug. See also https://bugs.php.net/bug.php?id=65911 static::$this in PHP 5.4.21 was equal to just $this. Previous Comments: ------------------------------------------------------------------------ [2013-11-29 12:44:42] gulturyan at gmail dot com perhaps it was an undocumented feature sorry. I can use get_called_class() ------------------------------------------------------------------------ [2013-11-29 09:20:31] nikic@php.net You are accessing the static property $this, which does not exist in your code sample. So you get an error. What's incorrect about this? ------------------------------------------------------------------------ [2013-11-29 09:18:33] gulturyan at gmail dot com Description: ------------ in version 5.4.22 not working static::$this in version 5.4.21 still work. Test script: --------------- class A { public function aa() { return get_class(static::$this); } } class A2 extends A { } $a = new A2(); die(var_dump($a->aa())); Expected result: ---------------- A2 Actual result: -------------- Fatal error: Access to undeclared static property: A2::$this ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66199&edit=1

« previous php.bugs (#183011) next »