|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73487 Non-static method does not throw E_DEPRECATED
Submitted: 2016-11-10 12:44 UTC Modified: 2016-11-10 15:00 UTC
From: vyants at dengisrazy dot ru Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 7.0.13 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: vyants at dengisrazy dot ru
New email:
PHP Version: OS:


 [2016-11-10 12:44 UTC] vyants at dengisrazy dot ru
PHP does not throw E_DEPRECATED exception when non static method calls as static inside object.

Test script:

class Foo {
    public function bar()
        echo "1";
    public function bar2()

$class = new Foo();

//!!! no exception

Expected result:

Actual result:
$class::bar() - throw Exception
but $class->bar2() - work without exception


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-10 15:00 UTC]
-Status: Open +Status: Not a bug
 [2016-11-10 15:00 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

"static::bar()" does not mean to call the bar method statically. Rather the "static" indicates the use of late static binding (LSB) and means to call the bar method of the class which was originally invoked. Just like how "self::" means to call a method on the class currently executing, or "parent::" on the superclass.

See example #3 in the documentation for late static binding.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 05:01:31 2024 UTC