From 42a2fb8411848236d0cd56b5efd05e352e62ee3d Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 9 Dec 2019 13:49:12 +0300 Subject: [PATCH] Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used) --- NEWS | 4 ++++ ext/reflection/php_reflection.c | 3 ++- ext/reflection/tests/bug78895.phpt | 38 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 ext/reflection/tests/bug78895.phpt diff --git a/NEWS b/NEWS index 787a546135..afa5823d32 100644 --- a/NEWS +++ b/NEWS @@ -37,6 +37,10 @@ PHP NEWS - PCRE: . Fixed bug #78853 (preg_match() may return integer > 1). (cmb) +- Reflection: + . Fixed bug #78895 (Reflection detects abstract non-static class as abstract + static. IS_IMPLICIT_ABSTRACT is not longer used). (Dmitry) + - Standard: . Fixed bug #77638 (var_export'ing certain class instances segfaults). (cmb) . Fixed bug #78840 (imploding $GLOBALS crashes). (cmb) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index d669ff6da2..386130a307 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4574,7 +4574,7 @@ ZEND_METHOD(reflection_class, getModifiers) reflection_object *intern; zend_class_entry *ce; uint32_t keep_flags = ZEND_ACC_FINAL - | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; + | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; if (zend_parse_parameters_none() == FAILURE) { return; @@ -6835,6 +6835,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ zend_class_implements(reflection_class_ptr, 1, reflector_ptr); zend_declare_property_string(reflection_class_ptr, "name", sizeof("name")-1, "", ZEND_ACC_PUBLIC); + /* IS_IMPLICIT_ABSTRACT is not longer used */ REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS); REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL); diff --git a/ext/reflection/tests/bug78895.phpt b/ext/reflection/tests/bug78895.phpt new file mode 100644 index 0000000000..7e616c4456 --- /dev/null +++ b/ext/reflection/tests/bug78895.phpt @@ -0,0 +1,38 @@ +--TEST-- +Fixed bug #78895 (Reflection detects abstract non-static class as abstract static). +--FILE-- +getModifiers())); +$ref = new ReflectionClass(I::class); +var_dump(Reflection::getModifierNames($ref->getModifiers())); +$ref = new ReflectionClass(T::class); +var_dump(Reflection::getModifierNames($ref->getModifiers())); +$ref = new ReflectionClass(Bar::class); +var_dump(Reflection::getModifierNames($ref->getModifiers())); +?> +--EXPECT-- +array(1) { + [0]=> + string(8) "abstract" +} +array(0) { +} +array(0) { +} +array(0) { +} \ No newline at end of file -- 2.40.0