Bug->Doc #75359 [Ver]: multiple declaration for visibility or const inline.

From: Date: Wed, 11 Oct 2017 17:18:36 +0000
Subject: Bug->Doc #75359 [Ver]: multiple declaration for visibility or const inline.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15070@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: Verified -Type: Bug +Type: Documentation Problem Package: Documentation problem Operating System: irrevelant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: > Why is this a bug? Of course, it is a doc bug (not a feature request). Previous Comments: ------------------------------------------------------------------------ [2017-10-11 13:56:08] requinix@php.net 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 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

« previous php.doc.bugs (#15070) next »