Req #76199 [NEW]: __METHOD__ and Paamayim Nekudotayim
| From: | valentiny510 at gmail dot com | Date: | Sun, 08 Apr 2018 18:29:52 +0000 |
| Subject: | Req #76199 [NEW]: __METHOD__ and Paamayim Nekudotayim | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214653@lists.php.net to get a copy of this message | ||
From: valentiny510 at gmail dot com
Operating system: X
PHP version: 7.2.4
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:__METHOD__ and Paamayim Nekudotayim
Description:
------------
__METHOD__ return the double colon inside the classes no matter what the
scope is. I think it should return -> for non static methods.
I know, I know.. is a very long shot and is somehow useless this
scenario but...
imagine the script below.
Maybe would also avoid some confusions, for instance, if you want to
debug and you just want to return the name of the method without
executing it...
Is not a big deal but anyways... Thank you
Test script:
---------------
class Test {
function n($n, $return_method = false) {
if ($return_method)
return __METHOD__;
return "N is $n";
}
}
$test = new Test;
$method = $test->n(5, true);
print $method . PHP_EOL;
print $method(5) . PHP_EOL;
Expected result:
----------------
Test::n
N is 5
Actual result:
--------------
Test::n
Deprecated: Non-static method Test::n() should not be called statically
N is 5
--
Edit bug report at https://bugs.php.net/bug.php?id=76199&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76199&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76199&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76199&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76199&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76199&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76199&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76199&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76199&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76199&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76199&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76199&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76199&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76199&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76199&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76199&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76199&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76199&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76199&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76199&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76199&r=mysqlcfg