From: Guilherme Blanco Date: Sat, 22 Nov 2014 04:57:55 +0000 (+0000) Subject: Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently... X-Git-Tag: PRE_NATIVE_TLS_MERGE~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=094d409b3d34c51f49e0121e5ccfe8b2a717aaf6;p=php 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. --- diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index bf0ba0ace4..b9d097c424 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -445,7 +445,7 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Closure", closure_functions); zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_closure->ce_flags |= ZEND_ACC_FINAL; zend_ce_closure->create_object = zend_closure_new; zend_ce_closure->serialize = zend_class_serialize_deny; zend_ce_closure->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index c44b37b995..3b1e046cc0 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -182,7 +182,6 @@ typedef struct _zend_try_catch_element { /* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */ #define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10 #define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20 -#define ZEND_ACC_FINAL_CLASS 0x40 #define ZEND_ACC_INTERFACE 0x80 #define ZEND_ACC_TRAIT 0x120 diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 2d1810ef78..c3827c5c51 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -671,7 +671,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Generator", generator_functions); zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_generator->ce_flags |= ZEND_ACC_FINAL; zend_ce_generator->create_object = zend_generator_create; zend_ce_generator->serialize = zend_class_serialize_deny; zend_ce_generator->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index cf2a3cb4ad..9b81978e6e 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -727,7 +727,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) { zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val); } - if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (parent_ce->ce_flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val); } diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 94734defe2..4d66648055 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -435,7 +435,7 @@ class_declaration_statement: class_type: T_CLASS { $$ = 0; } | T_ABSTRACT T_CLASS { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } - | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL_CLASS; } + | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL; } | T_TRAIT { $$ = ZEND_ACC_TRAIT; } ; diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 878c8fb946..6d7210fe59 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -625,7 +625,7 @@ PHP_MINIT_FUNCTION(mysqli) zend_declare_property_null(ce, "embedded", sizeof("embedded") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(ce, "reconnect", sizeof("reconnect") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(ce, "report_mode", sizeof("report_mode") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); - ce->ce_flags |= ZEND_ACC_FINAL_CLASS; + ce->ce_flags |= ZEND_ACC_FINAL; zend_hash_add_ptr(&classes, ce->name, &mysqli_driver_properties); REGISTER_MYSQLI_CLASS_ENTRY("mysqli", mysqli_link_class_entry, mysqli_link_methods); @@ -655,7 +655,7 @@ PHP_MINIT_FUNCTION(mysqli) REGISTER_MYSQLI_CLASS_ENTRY("mysqli_warning", mysqli_warning_class_entry, mysqli_warning_methods); ce = mysqli_warning_class_entry; - ce->ce_flags |= ZEND_ACC_FINAL_CLASS | ZEND_ACC_PROTECTED; + ce->ce_flags |= ZEND_ACC_FINAL; zend_hash_init(&mysqli_warning_properties, 0, NULL, free_prop_handler, 1); MYSQLI_ADD_PROPERTIES(&mysqli_warning_properties, mysqli_warning_property_entries); zend_declare_property_null(ce, "message", sizeof("message") - 1, ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 27cc157ed7..1491c80cfd 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2292,7 +2292,7 @@ void pdo_stmt_init(TSRMLS_D) INIT_CLASS_ENTRY(ce, "PDORow", pdo_row_functions); pdo_row_ce = zend_register_internal_class(&ce TSRMLS_CC); - pdo_row_ce->ce_flags |= ZEND_ACC_FINAL_CLASS; /* when removing this a lot of handlers need to be redone */ + pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */ pdo_row_ce->create_object = pdo_row_new; pdo_row_ce->serialize = pdo_row_serialize; } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index f82b825631..d23c7cd6c6 100755 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -5308,11 +5308,11 @@ void phar_object_init(TSRMLS_D) /* {{{ */ #else INIT_CLASS_ENTRY(ce, "Phar", php_archive_methods); phar_ce_archive = zend_register_internal_class(&ce TSRMLS_CC); - phar_ce_archive->ce_flags |= ZEND_ACC_FINAL_CLASS; + phar_ce_archive->ce_flags |= ZEND_ACC_FINAL; INIT_CLASS_ENTRY(ce, "PharData", php_archive_methods); phar_ce_data = zend_register_internal_class(&ce TSRMLS_CC); - phar_ce_data->ce_flags |= ZEND_ACC_FINAL_CLASS; + phar_ce_data->ce_flags |= ZEND_ACC_FINAL; #endif REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "BZ2", PHAR_ENT_COMPRESSED_BZ2) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 18906d6004..026680cd6d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -395,7 +395,7 @@ static void _class_string(string *str, zend_class_entry *ce, zval *obj, char *in if (ce->ce_flags & (ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { string_printf(str, "abstract "); } - if (ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (ce->ce_flags & ZEND_ACC_FINAL) { string_printf(str, "final "); } string_printf(str, "class "); @@ -1557,7 +1557,7 @@ ZEND_METHOD(reflection, getModifierNames) if (modifiers & (ZEND_ACC_ABSTRACT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) { add_next_index_stringl(return_value, "abstract", sizeof("abstract")-1); } - if (modifiers & (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) { + if (modifiers & ZEND_ACC_FINAL) { add_next_index_stringl(return_value, "final", sizeof("final")-1); } if (modifiers & ZEND_ACC_IMPLICIT_PUBLIC) { @@ -4162,7 +4162,7 @@ ZEND_METHOD(reflection_class, isTrait) Returns whether this class is final */ ZEND_METHOD(reflection_class, isFinal) { - _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL_CLASS); + _class_check_flag(INTERNAL_FUNCTION_PARAM_PASSTHRU, ZEND_ACC_FINAL); } /* }}} */ @@ -4290,7 +4290,7 @@ ZEND_METHOD(reflection_class, newInstanceWithoutConstructor) METHOD_NOTSTATIC(reflection_class_ptr); GET_REFLECTION_OBJECT_PTR(ce); - if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (ce->create_object != NULL && ce->ce_flags & ZEND_ACC_FINAL) { 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); } @@ -6187,7 +6187,7 @@ PHP_MINIT_FUNCTION(reflection) /* {{{ */ 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_CLASS); + REGISTER_REFLECTION_CLASS_CONST_LONG(class, "IS_FINAL", ZEND_ACC_FINAL); INIT_CLASS_ENTRY(_reflection_entry, "ReflectionObject", reflection_object_functions); _reflection_entry.create_object = reflection_objects_new; diff --git a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt index 65f23c935f..8d2bd47d12 100644 --- a/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getModifiers_basic.phpt @@ -30,7 +30,7 @@ dump_modifiers('g'); --EXPECT-- int(0) int(32) -int(64) +int(4) int(128) int(524288) int(524416) diff --git a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt index 941bfe5f2b..1e0a97dfe0 100644 --- a/ext/reflection/tests/ReflectionClass_modifiers_001.phpt +++ b/ext/reflection/tests/ReflectionClass_modifiers_001.phpt @@ -37,7 +37,7 @@ int(0) bool(true) bool(false) bool(false) -int(64) +int(4) bool(false) bool(true) bool(false) diff --git a/ext/reflection/tests/ReflectionClass_toString_001.phpt b/ext/reflection/tests/ReflectionClass_toString_001.phpt index 8dd571c3a9..c47aba8b8d 100644 --- a/ext/reflection/tests/ReflectionClass_toString_001.phpt +++ b/ext/reflection/tests/ReflectionClass_toString_001.phpt @@ -14,7 +14,7 @@ Class [ class ReflectionClass implements Reflector ] { - Constants [3] { Constant [ integer IS_IMPLICIT_ABSTRACT ] { 16 } Constant [ integer IS_EXPLICIT_ABSTRACT ] { 32 } - Constant [ integer IS_FINAL ] { 64 } + Constant [ integer IS_FINAL ] { 4 } } - Static properties [0] { diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 8ca27d7b9a..23531e9ae3 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -1037,7 +1037,7 @@ static PHP_MINIT_FUNCTION(tidy) REGISTER_INI_ENTRIES(); REGISTER_TIDY_CLASS(tidy, doc, NULL, 0); - REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS); + REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL); tidy_object_handlers_doc.cast_object = tidy_doc_cast_handler; tidy_object_handlers_node.cast_object = tidy_node_cast_handler;