[php-src] master: Filter return value of ReflectionClassConstant::getModifiers()

From: Date: Wed, 28 Apr 2021 12:57:06 +0000
Subject: [php-src] master: Filter return value of ReflectionClassConstant::getModifiers()
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-115935@lists.php.net to get a copy of this message
Author: Nikita Popov (nikic) Date: 2021-04-28T14:55:37+02:00 Commit: https://github.com/php/php-src/commit/5295e368b4332d87f83f7ca2a20331115fd6e227 Raw diff: https://github.com/php/php-src/commit/5295e368b4332d87f83f7ca2a20331115fd6e227.diff Filter return value of ReflectionClassConstant::getModifiers() Don't return internal flags like IS_CASE. Changed paths: M ext/reflection/php_reflection.c M ext/reflection/tests/ReflectionEnumUnitCase_construct.phpt Diff: diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 232b477ab8d3b..048fd3e59c9e2 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -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); } /* }}} */ diff --git a/ext/reflection/tests/ReflectionEnumUnitCase_construct.phpt b/ext/reflection/tests/ReflectionEnumUnitCase_construct.phpt index de5af5c549c11..18ab0222eb5b0 100644 --- a/ext/reflection/tests/ReflectionEnumUnitCase_construct.phpt +++ b/ext/reflection/tests/ReflectionEnumUnitCase_construct.phpt @@ -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

« previous php.cvs (#115935) next »