|  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
 [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-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 03:01:27 2023 UTC