Commit f605d20cfd2 for php.net

commit f605d20cfd23417230c5b5e5e5269530b10e0e8f
Merge: 62ea5944de8 86d78cc24f1
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date:   Thu Jun 25 18:55:02 2026 -0400

    Merge branch 'PHP-8.4' into PHP-8.5

    * PHP-8.4:
      Report dynamic property shadowing a private parent in Reflection

diff --cc NEWS
index 4a08f3391d7,0f39334377e..ef8d40d00f8
--- a/NEWS
+++ b/NEWS
@@@ -31,9 -18,11 +31,11 @@@ PH
  - Reflection:
    . Fixed bug GH-22324 (Ignore leading namespace separator in
      ReflectionParameter::__construct()). (jorgsowa)
+   . Fixed bug GH-22441 (ReflectionClass::hasProperty() and getProperty() ignore
+     dynamic properties shadowing a private parent property). (iliaal)

  - SPL:
 -  . Fix class_parents for classes with leading slash in non-autoload mode.
 +  . Fix	class_parents for classes with leading slash in non-autoload mode.
      (jorgsowa)
    . Ignore leading back-slash in class_parents(), class_implements(), and
      class_uses(). (jorgsowa)
diff --cc ext/reflection/php_reflection.c
index 5d7a15e24fe,e747a642778..956e6ea22d4
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@@ -4616,19 -4699,17 +4616,17 @@@ ZEND_METHOD(ReflectionClass, hasPropert
  	}

  	GET_REFLECTION_OBJECT_PTR(ce);
- 	if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL) {
- 		if ((property_info->flags & ZEND_ACC_PRIVATE) && property_info->ce != ce) {
- 			RETURN_FALSE;
- 		}
+ 	if ((property_info = zend_hash_find_ptr(&ce->properties_info, name)) != NULL
+ 	 && (!(property_info->flags & ZEND_ACC_PRIVATE)
+ 	  || property_info->ce == ce)) {
  		RETURN_TRUE;
- 	} else {
- 		if (Z_TYPE(intern->obj) != IS_UNDEF) {
- 			if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, ZEND_PROPERTY_EXISTS, NULL)) {
- 				RETURN_TRUE;
- 			}
+ 	}
+ 	if (Z_TYPE(intern->obj) != IS_UNDEF) {
 -		if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, 2, NULL)) {
++		if (Z_OBJ_HANDLER(intern->obj, has_property)(Z_OBJ(intern->obj), name, ZEND_PROPERTY_EXISTS, NULL)) {
+ 			RETURN_TRUE;
  		}
- 		RETURN_FALSE;
  	}
+ 	RETURN_FALSE;
  }
  /* }}} */