You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
640 B

--TEST--
Class private constant visibility
--FILE--
<?php
class A {
private const privateConst = 'privateConst';
static function staticConstDump() {
var_dump(self::privateConst);
}
function constDump() {
var_dump(self::privateConst);
}
}
A::staticConstDump();
(new A())->constDump();
constant('A::privateConst');
?>
--EXPECTF--
string(12) "privateConst"
string(12) "privateConst"
Warning: constant(): Couldn't find constant A::privateConst in %s on line 14
Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14
Stack trace:
#0 %s(14): constant('A::privateConst')
#1 {main}
thrown in %s on line 14