php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63633 Static and non-static methods are equal
Submitted: 2012-11-28 10:03 UTC Modified: 2012-11-28 10:19 UTC
From: mark-kreine at yandex dot ru Assigned:
Status: Closed Package: *General Issues
PHP Version: 5.4.9 OS: Ubuntu 12.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mark-kreine at yandex dot ru
New email:
PHP Version: OS:

 

 [2012-11-28 10:03 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-28 10:19 UTC] mark-kreine at yandex dot ru
-Status: Open +Status: Closed
 [2012-11-28 10:19 UTC] mark-kreine at yandex dot ru
Problem solved
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 03 17:01:27 2025 UTC