php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43924 Overloading methods can be static and non-public
Submitted: 2008-01-23 22:47 UTC Modified: 2008-07-02 15:29 UTC
From: felipe@php.net Assigned: danielc (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3CVS-2008-01-23 (CVS) OS:
Private report: No CVE-ID: None
 [2008-01-23 22:47 UTC] felipe@php.net
Description:
------------
Says the documentation:
"All overloading methods must not be defined as static. All overloading methods must be defined as public."
However, this rule doesn't exists.

Reproduce code:
---------------
<?php

class foobar
{
    static private function __call($x, $y) {
        printf("[[%s]]\n", $x);
    }
}

$foo = new foobar;
$foo->test();

?>

Expected result:
----------------
Some error message.

Actual result:
--------------
[[test]]

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-24 09:34 UTC] felipe@php.net
"All overloading methods must not be defined as static."

Ok. I mean the phrase references just concept, whereas $this isn't allowed in static methods.

But, "All overloading methods must be defined as public.", really isn't true.


 [2008-02-09 01:04 UTC] stas@php.net
It looks like right now the engine just ignores qualifiers on such methods. I.e. __call you defined in fact won't be static or private. 
 [2008-07-02 15:29 UTC] danielc@php.net
PHP now throws the following warning: "The magic method __isset() must have public visibility and can not be static."  Documentation has been updated accordingly.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 07:01:32 2024 UTC