Skip to content

Commit 094d409

Browse files
Guilherme BlancoJulien Pauli
authored andcommitted
Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before.
1 parent 5ad01e1 commit 094d409

13 files changed

+18
-19
lines changed

Zend/zend_closures.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */
445445

446446
INIT_CLASS_ENTRY(ce, "Closure", closure_functions);
447447
zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC);
448-
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS;
448+
zend_ce_closure->ce_flags |= ZEND_ACC_FINAL;
449449
zend_ce_closure->create_object = zend_closure_new;
450450
zend_ce_closure->serialize = zend_class_serialize_deny;
451451
zend_ce_closure->unserialize = zend_class_unserialize_deny;

Zend/zend_compile.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ typedef struct _zend_try_catch_element {
182182
/* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */
183183
#define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10
184184
#define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20
185-
#define ZEND_ACC_FINAL_CLASS 0x40
186185
#define ZEND_ACC_INTERFACE 0x80
187186
#define ZEND_ACC_TRAIT 0x120
188187

Zend/zend_generators.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */
671671

672672
INIT_CLASS_ENTRY(ce, "Generator", generator_functions);
673673
zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC);
674-
zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS;
674+
zend_ce_generator->ce_flags |= ZEND_ACC_FINAL;
675675
zend_ce_generator->create_object = zend_generator_create;
676676
zend_ce_generator->serialize = zend_class_serialize_deny;
677677
zend_ce_generator->unserialize = zend_class_unserialize_deny;

Zend/zend_inheritance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
727727
&& !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) {
728728
zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val);
729729
}
730-
if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
730+
if (parent_ce->ce_flags & ZEND_ACC_FINAL) {
731731
zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val);
732732
}
733733

Zend/zend_language_parser.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ class_declaration_statement:
435435
class_type:
436436
T_CLASS { $$ = 0; }
437437
| T_ABSTRACT T_CLASS { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
438-
| T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL_CLASS; }
438+
| T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL; }
439439
| T_TRAIT { $$ = ZEND_ACC_TRAIT; }
440440
;
441441

ext/mysqli/mysqli.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(mysqli)
625625
zend_declare_property_null(ce, "embedded", sizeof("embedded") - 1, ZEND_ACC_PUBLIC TSRMLS_CC);
626626
zend_declare_property_null(ce, "reconnect", sizeof("reconnect") - 1, ZEND_ACC_PUBLIC TSRMLS_CC);
627627
zend_declare_property_null(ce, "report_mode", sizeof("report_mode") - 1, ZEND_ACC_PUBLIC TSRMLS_CC);
628-
ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
628+
ce->ce_flags |= ZEND_ACC_FINAL;
629629
zend_hash_add_ptr(&classes, ce->name, &mysqli_driver_properties);
630630

631631
REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods);
@@ -655,7 +655,7 @@ PHP_MINIT_FUNCTION(mysqli)
655655

656656
REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods);
657657
ce = mysqli_warning_class_entry;
658-
ce->ce_flags |= ZEND_ACC_FINAL_CLASS | ZEND_ACC_PROTECTED;
658+
ce->ce_flags |= ZEND_ACC_FINAL;
659659
zend_hash_init(&mysqli_warning_properties, 0, NULL, free_prop_handler, 1);
660660
MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries);
661661
zend_declare_property_null(ce, "message", sizeof("message") - 1, ZEND_ACC_PUBLIC TSRMLS_CC);

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2292,7 +2292,7 @@ void pdo_stmt_init(TSRMLS_D)
22922292

22932293
INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions);
22942294
pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC);
2295-
pdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */
2295+
pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */
22962296
pdo_row_ce->create_object = pdo_row_new;
22972297
pdo_row_ce->serialize = pdo_row_serialize;
22982298
}

ext/phar/phar_object.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5308,11 +5308,11 @@ void phar_object_init(TSRMLS_D) /* {{{ */
53085308
#else
53095309
INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods);
53105310
phar_ce_archive = zend_register_internal_class(&ce TSRMLS_CC);
5311-
phar_ce_archive->ce_flags |= ZEND_ACC_FINAL_CLASS;
5311+
phar_ce_archive->ce_flags |= ZEND_ACC_FINAL;
53125312

53135313
INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods);
53145314
phar_ce_data = zend_register_internal_class(&ce TSRMLS_CC);
5315-
phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS;
5315+
phar_ce_data->ce_flags |= ZEND_ACC_FINAL;
53165316
#endif
53175317

53185318
REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2)

ext/reflection/php_reflection.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in
395395
if (ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
396396
string_printf(str, "abstract ");
397397
}
398-
if (ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
398+
if (ce->ce_flags & ZEND_ACC_FINAL) {
399399
string_printf(str, "final ");
400400
}
401401
string_printf(str, "class ");
@@ -1557,7 +1557,7 @@ ZEND_METHOD(reflection, getModifierNames)
15571557
if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
15581558
add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1);
15591559
}
1560-
if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) {
1560+
if (modifiers & ZEND_ACC_FINAL) {
15611561
add_next_index_stringl(return_value, "final", sizeof("final")-1);
15621562
}
15631563
if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) {
@@ -4162,7 +4162,7 @@ ZEND_METHOD(reflection_class, isTrait)
41624162
Returns whether this class is final */
41634163
ZEND_METHOD(reflection_class, isFinal)
41644164
{
4165-
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL_CLASS);
4165+
_class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL);
41664166
}
41674167
/* }}} */
41684168

@@ -4290,7 +4290,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor)
42904290
METHOD_NOTSTATIC(reflection_class_ptr);
42914291
GET_REFLECTION_OBJECT_PTR(ce);
42924292

4293-
if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL_CLASS) {
4293+
if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) {
42944294
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s is an internal class marked as final that cannot be instantiated without invoking its constructor", ce->name->val);
42954295
}
42964296

@@ -6187,7 +6187,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */
61876187

61886188
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_IMPLICIT_ABSTRACT", ZEND_ACC_IMPLICIT_ABSTRACT_CLASS);
61896189
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_EXPLICIT_ABSTRACT", ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
6190-
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL_CLASS);
6190+
REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL);
61916191

61926192
INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions);
61936193
_reflection_entry.create_object = reflection_objects_new;

ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dump_modifiers('g');
3030
--EXPECT--
3131
int(0)
3232
int(32)
33-
int(64)
33+
int(4)
3434
int(128)
3535
int(524288)
3636
int(524416)

ext/reflection/tests/ReflectionClass_modifiers_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int(0)
3737
bool(true)
3838
bool(false)
3939
bool(false)
40-
int(64)
40+
int(4)
4141
bool(false)
4242
bool(true)
4343
bool(false)

ext/reflection/tests/ReflectionClass_toString_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Class [ <internal:Reflection> class ReflectionClass implements Reflector ] {
1414
- Constants [3] {
1515
Constant [ integer IS_IMPLICIT_ABSTRACT ] { 16 }
1616
Constant [ integer IS_EXPLICIT_ABSTRACT ] { 32 }
17-
Constant [ integer IS_FINAL ] { 64 }
17+
Constant [ integer IS_FINAL ] { 4 }
1818
}
1919

2020
- Static properties [0] {

ext/tidy/tidy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ static PHP_MINIT_FUNCTION(tidy)
10371037

10381038
REGISTER_INI_ENTRIES();
10391039
REGISTER_TIDY_CLASS(tidy, doc, NULL, 0);
1040-
REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS);
1040+
REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL);
10411041

10421042
tidy_object_handlers_doc.cast_object = tidy_doc_cast_handler;
10431043
tidy_object_handlers_node.cast_object = tidy_node_cast_handler;

0 commit comments

Comments
 (0)