mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Filter return value of ReflectionClassConstant::getModifiers()
Don't return internal flags like IS_CASE.
This commit is contained in:
@@ -3702,7 +3702,7 @@ ZEND_METHOD(ReflectionClassConstant, getModifiers)
|
||||
}
|
||||
GET_REFLECTION_OBJECT_PTR(ref);
|
||||
|
||||
RETURN_LONG(ZEND_CLASS_CONST_FLAGS(ref));
|
||||
RETURN_LONG(ZEND_CLASS_CONST_FLAGS(ref) & ZEND_ACC_PPP_MASK);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
@@ -8,7 +8,10 @@ enum Foo {
|
||||
const Baz = self::Bar;
|
||||
}
|
||||
|
||||
echo (new ReflectionEnumUnitCase(Foo::class, 'Bar'))->getName() . "\n";
|
||||
$case = new ReflectionEnumUnitCase(Foo::class, 'Bar');
|
||||
var_dump($case->getName());
|
||||
var_dump($case->isPublic());
|
||||
var_dump($case->getModifiers());
|
||||
|
||||
try {
|
||||
new ReflectionEnumUnitCase(Foo::class, 'Baz');
|
||||
@@ -30,7 +33,9 @@ try {
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Bar
|
||||
string(3) "Bar"
|
||||
bool(true)
|
||||
int(1)
|
||||
Constant Foo::Baz is not a case
|
||||
Constant Foo::Qux does not exist
|
||||
ReflectionEnumUnitCase::__construct(): Argument #1 ($class) must be of type object|string, array given
|
||||
|
||||
Reference in New Issue
Block a user