php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34095 language/oop5/static.xml unclear about methods
Submitted: 2005-08-12 12:28 UTC Modified: 2005-08-30 17:08 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: simp@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
 [2005-08-12 12:28 UTC] simp@php.net
Description:
------------
Manual is a bit unclear about static methods. It doesn't imply that calling non-static methods in a static context (using the paamayim nekudotayim operator) is still valid.

Reproduce code:
---------------
<?php
class Foo {
    public function __construct() {
    }
    
    public function fromObject() {
        echo 'A call from the object <br/>';
    }   
    
    public static function fromStatic() {
        echo 'A static call <br/>';
    }
}

Foo::fromObject();
Foo::fromStatic();
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-30 17:08 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

It's possible but not recommended: "Calling non-static methods statically generates an E_STRICT level warning."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 21:00:03 2025 UTC