mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Remove ZEND_ACC_INHERITED flag
It is equivalent to checking ce->parent != NULL. Just adds more state that needs to be kept in sync.
This commit is contained in:
parent
ac89139773
commit
4f5f72c7af
@ -6606,7 +6606,6 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
|
||||
if (extends_ast) {
|
||||
ce->parent_name =
|
||||
zend_resolve_const_class_name_reference(extends_ast, "class name");
|
||||
ce->ce_flags |= ZEND_ACC_INHERITED;
|
||||
}
|
||||
|
||||
CG(active_class_entry) = ce;
|
||||
|
@ -229,7 +229,7 @@ typedef struct _zend_oparray_context {
|
||||
/* op_array or class is preloaded | | | */
|
||||
#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */
|
||||
/* | | | */
|
||||
/* Class Flags (unused: 24...) | | | */
|
||||
/* Class Flags (unused: 13, 24...) | | | */
|
||||
/* =========== | | | */
|
||||
/* | | | */
|
||||
/* Special class types | | | */
|
||||
@ -251,9 +251,6 @@ typedef struct _zend_oparray_context {
|
||||
/* Class constants updated | | | */
|
||||
#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */
|
||||
/* | | | */
|
||||
/* Class extends another class | | | */
|
||||
#define ZEND_ACC_INHERITED (1 << 13) /* X | | | */
|
||||
/* | | | */
|
||||
/* Class implements interface(s) | | | */
|
||||
#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */
|
||||
/* | | | */
|
||||
|
@ -177,11 +177,11 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
|
||||
/* objects with destructors should escape */
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
|
||||
uint32_t forbidden_flags = ZEND_ACC_INHERITED
|
||||
uint32_t forbidden_flags =
|
||||
/* These flags will always cause an exception */
|
||||
| ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
|
||||
ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
|
||||
| ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT;
|
||||
if (ce && !ce->create_object && !ce->constructor &&
|
||||
if (ce && !ce->parent && !ce->create_object && !ce->constructor &&
|
||||
!ce->destructor && !ce->__get && !ce->__set &&
|
||||
!(ce->ce_flags & forbidden_flags) &&
|
||||
(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
|
||||
@ -247,8 +247,7 @@ static int is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var
|
||||
if (opline->op1_type == IS_CONST) {
|
||||
zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
|
||||
if (ce && !ce->create_object && !ce->constructor &&
|
||||
!ce->destructor && !ce->__get && !ce->__set &&
|
||||
!(ce->ce_flags & ZEND_ACC_INHERITED)) {
|
||||
!ce->destructor && !ce->__get && !ce->__set && !ce->parent) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -4538,8 +4538,7 @@ int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ss
|
||||
zend_class_entry *ce = var_info->ce;
|
||||
|
||||
if (var_info->is_instanceof ||
|
||||
!ce || ce->create_object || ce->__get || ce->__set ||
|
||||
(ce->ce_flags & ZEND_ACC_INHERITED)) {
|
||||
!ce || ce->create_object || ce->__get || ce->__set || ce->parent) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -8842,28 +8842,23 @@ static uint32_t zend_get_known_property_offset(zend_class_entry *ce, zend_string
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
}
|
||||
|
||||
if (ce->ce_flags & ZEND_ACC_INHERITED) {
|
||||
if (!ce->parent) {
|
||||
/* property offsets may be changed by inheritance */
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
} else {
|
||||
zend_class_entry *parent = ce->parent;
|
||||
if (ce->parent) {
|
||||
zend_class_entry *parent = ce->parent;
|
||||
|
||||
do {
|
||||
if (parent->type == ZEND_INTERNAL_CLASS) {
|
||||
break;
|
||||
} else if (parent->info.user.filename != filename) {
|
||||
/* some of parents class declarations might be changed infdependently */
|
||||
/* TODO: this check may be not enough, because even
|
||||
* in the same it's possible to conditionally define
|
||||
* few classes with the same name, and "parent" may
|
||||
* change from request to request.
|
||||
*/
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
}
|
||||
parent = parent->parent;
|
||||
} while (parent);
|
||||
}
|
||||
do {
|
||||
if (parent->type == ZEND_INTERNAL_CLASS) {
|
||||
break;
|
||||
} else if (parent->info.user.filename != filename) {
|
||||
/* some of parents class declarations might be changed infdependently */
|
||||
/* TODO: this check may be not enough, because even
|
||||
* in the same it's possible to conditionally define
|
||||
* few classes with the same name, and "parent" may
|
||||
* change from request to request.
|
||||
*/
|
||||
return ZEND_WRONG_PROPERTY_OFFSET;
|
||||
}
|
||||
parent = parent->parent;
|
||||
} while (parent);
|
||||
}
|
||||
|
||||
info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);
|
||||
|
Loading…
Reference in New Issue
Block a user