Fix bug #81474: Make ReflectionAttribute non-final

This backports GH-7520 to PHP 8.0.

Closes GH-7545.
This commit is contained in:
sasezaki 2021-10-02 17:50:08 +09:00 committed by Nikita Popov
parent 57a32c6a69
commit e286313fa7
5 changed files with 5 additions and 13 deletions

3
NEWS
View File

@ -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)

View File

@ -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);

View File

@ -653,7 +653,7 @@ final class ReflectionReference
private function __construct() {}
}
final class ReflectionAttribute
class ReflectionAttribute
{
public function getName(): string {}
public function getTarget(): int {}

View File

@ -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)

View File

@ -1,10 +0,0 @@
--TEST--
Check that ReflectionAttribute is final
--FILE--
<?php
class T extends ReflectionAttribute {}
?>
--EXPECTF--
Fatal error: Class T may not inherit from final class (ReflectionAttribute) in %s on line %d