Bug #63633 [Opn->Csd]: Static and non-static methods are equal
| From: | mark-kreine at yandex dot ru | Date: | Wed, 28 Nov 2012 10:19:19 +0000 |
| Subject: | Bug #63633 [Opn->Csd]: Static and non-static methods are equal | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174991@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63633&edit=1
ID: 63633
User updated by: mark-kreine at yandex dot ru
Reported by: mark-kreine at yandex dot ru
Summary: Static and non-static methods are equal
-Status: Open
+Status: Closed
Type: Bug
Package: *General Issues
Operating System: Ubuntu 12.10
PHP Version: 5.4.9
Block user comment: N
Private report: N
New Comment:
Problem solved
Previous Comments:
------------------------------------------------------------------------
[2012-11-28 10:03:22] mark-kreine at yandex dot ru
Description:
------------
Making method in class static or non-static makes absolutely no sense. For example, let's have
a class:
class Test
{
const t = 't';
public function testmethod()
{
echo self::t;
}
}
Then we do:
Test::testmethod()
Expecting to see some kind of error, instead I can see normal method execution, finally printing
't'. Adding keyword 'static' to the method declaration makes absolutely no
sense.
Test script:
---------------
class Test
{
const t = 't';
public static function testmethod()
{
echo self::t;
}
}
Expected result:
----------------
Some kind of error
Actual result:
--------------
This script prints "t", that is the contents of the class costant.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63633&edit=1