From e286313fa7a134c382e486566c52a0ff583fb2d1 Mon Sep 17 00:00:00 2001 From: sasezaki Date: Sat, 2 Oct 2021 17:50:08 +0900 Subject: [PATCH] Fix bug #81474: Make ReflectionAttribute non-final This backports GH-7520 to PHP 8.0. Closes GH-7545. --- NEWS | 3 +++ ext/reflection/php_reflection.c | 1 - ext/reflection/php_reflection.stub.php | 2 +- ext/reflection/php_reflection_arginfo.h | 2 +- ext/reflection/tests/ReflectionAttribute_final.phpt | 10 ---------- 5 files changed, 5 insertions(+), 13 deletions(-) delete mode 100644 ext/reflection/tests/ReflectionAttribute_final.phpt diff --git a/NEWS b/NEWS index c643c6b307a..a89b62162cc 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,9 @@ PHP NEWS - PCRE: . Fixed bug #81424 (PCRE2 10.35 JIT performance regression). (cmb) +- Reflection: + . ReflectionAttribute is no longer final. (sasezaki) + - SPL: . Fixed bug #80663 (Recursive SplFixedArray::setSize() may cause double-free). (cmb, Nikita, Tyson Andre) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index dd447d41740..f9b888f1c16 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6618,7 +6618,6 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ INIT_CLASS_ENTRY(_reflection_entry, "ReflectionAttribute", class_ReflectionAttribute_methods); reflection_init_class_handlers(&_reflection_entry); - _reflection_entry.ce_flags |= ZEND_ACC_FINAL; reflection_attribute_ptr = zend_register_internal_class(&_reflection_entry); REGISTER_REFLECTION_CLASS_CONST_LONG(attribute, "IS_INSTANCEOF", REFLECTION_ATTRIBUTE_IS_INSTANCEOF); diff --git a/ext/reflection/php_reflection.stub.php b/ext/reflection/php_reflection.stub.php index d12d10bd81d..b0bfade520f 100644 --- a/ext/reflection/php_reflection.stub.php +++ b/ext/reflection/php_reflection.stub.php @@ -653,7 +653,7 @@ final class ReflectionReference private function __construct() {} } -final class ReflectionAttribute +class ReflectionAttribute { public function getName(): string {} public function getTarget(): int {} diff --git a/ext/reflection/php_reflection_arginfo.h b/ext/reflection/php_reflection_arginfo.h index ba524b4f6d2..6fdc0c44d22 100644 --- a/ext/reflection/php_reflection_arginfo.h +++ b/ext/reflection/php_reflection_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6849bff1f2b343df4bd7e6da9c8adc555731e2d3 */ + * Stub hash: 6e98777552147f4a413db16ecd87c9a6931f9c00 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0) diff --git a/ext/reflection/tests/ReflectionAttribute_final.phpt b/ext/reflection/tests/ReflectionAttribute_final.phpt deleted file mode 100644 index f2899d9724a..00000000000 --- a/ext/reflection/tests/ReflectionAttribute_final.phpt +++ /dev/null @@ -1,10 +0,0 @@ ---TEST-- -Check that ReflectionAttribute is final ---FILE-- - ---EXPECTF-- -Fatal error: Class T may not inherit from final class (ReflectionAttribute) in %s on line %d