1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

GH-19691: Add asymmetric visibility to Reflection::getModifierNames() (#19697)

This commit is contained in:
Daniel Scherzer
2025-09-04 23:00:36 -07:00
committed by GitHub
parent 01ae278c47
commit c34558d125
3 changed files with 17 additions and 0 deletions

4
NEWS
View File

@@ -35,6 +35,10 @@ PHP NEWS
- PDO:
. Driver specific methods in the PDO class are now deprecated. (Arnaud)
- Reflection:
. Fix GH-19691 (getModifierNames() not reporting asymmetric visibility).
(DanielEScherzer)
- Session:
. Fix RC violation of session SID constant deprecation attribute. (ilutov)

View File

@@ -1713,6 +1713,15 @@ ZEND_METHOD(Reflection, getModifierNames)
add_next_index_stringl(return_value, "protected", sizeof("protected")-1);
break;
}
/* These are also mutually exclusive */
switch (modifiers & ZEND_ACC_PPP_SET_MASK) {
case ZEND_ACC_PROTECTED_SET:
add_next_index_stringl(return_value, "protected(set)", sizeof("protected(set)")-1);
break;
case ZEND_ACC_PRIVATE_SET:
add_next_index_stringl(return_value, "private(set)", sizeof("private(set)")-1);
break;
}
if (modifiers & ZEND_ACC_STATIC) {
add_next_index_str(return_value, ZSTR_KNOWN(ZEND_STR_STATIC));

View File

@@ -15,6 +15,8 @@ printModifiers(ReflectionMethod::IS_ABSTRACT | ReflectionMethod::IS_FINAL);
printModifiers(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_STATIC | ReflectionProperty::IS_READONLY);
printModifiers(ReflectionClass::IS_READONLY);
printModifiers(ReflectionProperty::IS_VIRTUAL);
printModifiers(ReflectionProperty::IS_PROTECTED_SET);
printModifiers(ReflectionProperty::IS_PRIVATE_SET);
?>
--EXPECT--
private
@@ -25,3 +27,5 @@ abstract,final
public,static,readonly
readonly
virtual
protected(set)
private(set)