|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75359 multiple declaration for visibility or const inline.
Submitted: 2017-10-11 12:13 UTC Modified: 2017-10-11 17:18 UTC
From: saymongcsw at gmail dot com Assigned:
Status: Verified Package: Documentation problem
PHP Version: Irrelevant OS: irrevelant
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: saymongcsw at gmail dot com
New email:
PHP Version: OS:


 [2017-10-11 12:13 UTC] saymongcsw at gmail dot com
I've found cool feature that isn't documented yet so it is as undefined behavior. And works in all PHP since 5.0.2+ and/or earlier.
I.e. missing documentation for multiple declaration visibility and/or constants.


Test script:

class test1
    const a = 'b', b = 'a', c = 'c';

    public function __construct()
        echo self::b, self::a, self::c, PHP_EOL;

class test2
    private $a = 'b', $b = 'a', $c = 'c';

try {
    new test1; // abc
    echo test2::$b, test2::$a, test2::$c; // Cannot access private property test2::$b
} catch (Error $e) {
    echo $e->getMessage();


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-11 13:38 UTC]
-Status: Open +Status: Verified -Type: Feature/Change Request +Type: Bug
 [2017-10-11 13:56 UTC]
Why is this a bug? ::a and ::$a are two different things. Meanwhile writing "test2::$b" is incorrect both because $b is not static and because it's private, but with Errors only one of those can be reported at a time.
 [2017-10-11 17:18 UTC]
-Type: Bug +Type: Documentation Problem
 [2017-10-11 17:18 UTC]
> Why is this a bug?

Of course, it is a doc bug (not a feature request).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 03:01:27 2024 UTC