Req->Bug #75359 [Opn->Ver]: multiple declaration for visibility or const inline.
| From: | cmb@php.net | Date: | Wed, 11 Oct 2017 13:38:09 +0000 |
| Subject: | Req->Bug #75359 [Opn->Ver]: multiple declaration for visibility or const inline. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15067@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75359&edit=1
ID: 75359
Updated by: cmb@php.net
Reported by: saymongcsw at gmail dot com
Summary: multiple declaration for visibility or const inline.
-Status: Open
+Status: Verified
-Type: Feature/Change Request
+Type: Bug
Package: Documentation problem
Operating System: irrevelant
PHP Version: Irrelevant
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-10-11 12:13:02] saymongcsw at gmail dot com
Description:
------------
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.
http://php.net/manual/en/language.oop5.visibility.php
http://php.net/manual/en/language.oop5.constants.php
Demo: https://3v4l.org/qRnlk
Test script:
---------------
<?php
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();
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75359&edit=1