#33361 [WFx]: $this in static context

From: Date: Thu, 16 Jun 2005 12:58:08 +0000
Subject: #33361 [WFx]: $this in static context
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-80441@lists.php.net to get a copy of this message
ID: 33361 User updated by: halmai at nexum dot hu Reported By: halmai at nexum dot hu Status: Wont fix Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.3.10 New Comment: In php5 when I use the keyword static then the value of the variable $this will always be null in this function. It's the correct behaviour because a static function can be called only without any instance. But if I want to call a function sometimes as an instance function and sometimes without any instances, then I have to omit the keyword static. But in this case I get the silly behaviour of php4, where I can not decide inside a function if it was called in static context or not. That's why I think this behaviour should be changed. Previous Comments: ------------------------------------------------------------------------ [2005-06-16 14:39:23] tony2001@php.net It works fine if you declare the method as static. If you don't do it - it works in the same way as in PHP4 just because of backward compatibility. ------------------------------------------------------------------------ [2005-06-16 14:33:52] halmai at nexum dot hu No, it is not perfect in version 5 neither. It works the same way in PHP 5.0.4 as in PHP 4.3.10. So, should I re-report it or can You assign this report to a newer PHP version? If You can, then please do it. Thanks in advance. ------------------------------------------------------------------------ [2005-06-16 14:08:06] tony2001@php.net >Should I re-report this for version 5. Why? It works perfectly there. ------------------------------------------------------------------------ [2005-06-16 14:02:14] halmai at nexum dot hu OK, I unsderstand. Should I re-report this for version 5. or is it possible somehow to modify the php-version of this report? I could simply overwrite the version in the form but I can not reopen the report because I have only the "Wontfix" and "Closed" options. ------------------------------------------------------------------------ [2005-06-16 13:57:06] tony2001@php.net As this is not a bug, it won't be changed in 4.3/4.4, because this is a bugfix-only branch. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/33361 -- Edit this bug report at http://bugs.php.net/?id=33361&edit=1

« previous php.bugs (#80441) next »