Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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)

Expand Down
9 changes: 9 additions & 0 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely needs ZEND_ACC_PUBLIC_SET for public public(set) readonly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested that and it just returned public and readonly though, just without the protected(set)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case ZEND_ACC_PUBLIC_SET:
	/* Unreachable */
	break;

as implicit documentation?

Copy link
Member

@iluuu1994 iluuu1994 Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. I forgot this is removed at compile time. The flag being absent makes sense for getModifiers, though it's a bit confusing here...


if (modifiers & ZEND_ACC_STATIC) {
add_next_index_str(return_value, ZSTR_KNOWN(ZEND_STR_STATIC));
Expand Down
4 changes: 4 additions & 0 deletions ext/reflection/tests/Reflection_getModifierNames_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,3 +27,5 @@ abstract,final
public,static,readonly
readonly
virtual
protected(set)
private(set)