mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
27 lines
552 B
PHP
27 lines
552 B
PHP
--TEST--
|
|
Class protected constant visibility
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
protected const protectedConst = 'protectedConst';
|
|
static function staticConstDump() {
|
|
var_dump(self::protectedConst);
|
|
}
|
|
function constDump() {
|
|
var_dump(self::protectedConst);
|
|
}
|
|
}
|
|
|
|
A::staticConstDump();
|
|
(new A())->constDump();
|
|
try {
|
|
constant('A::protectedConst');
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(14) "protectedConst"
|
|
string(14) "protectedConst"
|
|
Cannot access protected constant A::protectedConst
|