diff options
author | Nikita Popov <nikic@php.net> | 2014-10-09 13:58:14 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2014-10-09 13:58:14 +0200 |
commit | ee5b30fa197046973e813a80dd0b7c67827c0ae1 (patch) | |
tree | 71e0c4f24afee1eac312b7dae97448cc871c0421 /Zend | |
parent | 43f1c94ddace679cac008b674ef983199a951542 (diff) | |
download | php-git-ee5b30fa197046973e813a80dd0b7c67827c0ae1.tar.gz |
Remove support for classes without class entries
get_class_entry must be non-NULL and return non-NULL.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_API.c | 8 | ||||
-rw-r--r-- | Zend/zend_builtin_functions.c | 6 | ||||
-rw-r--r-- | Zend/zend_closures.c | 2 | ||||
-rw-r--r-- | Zend/zend_execute.h | 36 | ||||
-rw-r--r-- | Zend/zend_interfaces.c | 3 | ||||
-rw-r--r-- | Zend/zend_object_handlers.c | 1 | ||||
-rw-r--r-- | Zend/zend_object_handlers.h | 4 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 28 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 128 |
9 files changed, 71 insertions, 145 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index b965d20991..f5c60aacd0 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -198,12 +198,7 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ ZEND_API zend_class_entry *zend_get_class_entry(const zend_object *zobject TSRMLS_DC) /* {{{ */ { - if (zobject->handlers->get_class_entry) { - return zobject->handlers->get_class_entry(zobject TSRMLS_CC); - } else { - zend_error(E_ERROR, "Class entry requested for an object without PHP class"); - return NULL; - } + return zobject->handlers->get_class_entry(zobject TSRMLS_CC); } /* }}} */ @@ -3100,7 +3095,6 @@ get_function_via_handler: retval = 1; call_via_handler = (fcc->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) != 0; if (call_via_handler && !fcc->object && EG(current_execute_data) && Z_OBJ(EG(current_execute_data)->This) && - Z_OBJ_HT(EG(current_execute_data)->This)->get_class_entry && instanceof_function(Z_OBJCE(EG(current_execute_data)->This), fcc->calling_scope TSRMLS_CC)) { fcc->object = Z_OBJ(EG(current_execute_data)->This); } diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 9d567b47b7..614cfff4a1 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -905,7 +905,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /* if (!instance_ce) { RETURN_FALSE; } - } else if (Z_TYPE_P(obj) == IS_OBJECT && HAS_CLASS_ENTRY(*obj)) { + } else if (Z_TYPE_P(obj) == IS_OBJECT) { instance_ce = Z_OBJCE_P(obj); } else { RETURN_FALSE; @@ -1089,10 +1089,6 @@ ZEND_FUNCTION(get_class_methods) } if (Z_TYPE_P(klass) == IS_OBJECT) { - /* TBI!! new object handlers */ - if (!HAS_CLASS_ENTRY(*klass)) { - RETURN_FALSE; - } ce = Z_OBJCE_P(klass); } else if (Z_TYPE_P(klass) == IS_STRING) { ce = zend_lookup_class(Z_STR_P(klass) TSRMLS_CC); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 90d7a6bb86..e4827f83b7 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -140,7 +140,7 @@ ZEND_METHOD(Closure, bind) } if (scope_arg != NULL) { /* scope argument was given */ - if (IS_ZEND_STD_OBJECT(*scope_arg)) { + if (Z_TYPE_P(scope_arg) == IS_OBJECT) { ce = Z_OBJCE_P(scope_arg); } else if (Z_TYPE_P(scope_arg) == IS_NULL) { ce = NULL; diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 5178ab6c4b..a77446adb0 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -98,24 +98,22 @@ again: result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0); break; case IS_OBJECT: - if (IS_ZEND_STD_OBJECT(*op)) { - if (Z_OBJ_HT_P(op)->cast_object) { - zval tmp; - if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) { - result = Z_TYPE(tmp) == IS_TRUE; - break; - } - zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val); - } else if (Z_OBJ_HT_P(op)->get) { - zval rv; - zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv TSRMLS_CC); - if (Z_TYPE_P(tmp) != IS_OBJECT) { - /* for safety - avoid loop */ - convert_to_boolean(tmp); - result = Z_TYPE_P(tmp) == IS_TRUE; - zval_ptr_dtor(tmp); - break; - } + if (Z_OBJ_HT_P(op)->cast_object) { + zval tmp; + if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) { + result = Z_TYPE(tmp) == IS_TRUE; + break; + } + zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val); + } else if (Z_OBJ_HT_P(op)->get) { + zval rv; + zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv TSRMLS_CC); + if (Z_TYPE_P(tmp) != IS_OBJECT) { + /* for safety - avoid loop */ + convert_to_boolean(tmp); + result = Z_TYPE_P(tmp) == IS_TRUE; + zval_ptr_dtor(tmp); + break; } } result = 1; @@ -289,7 +287,7 @@ void zend_shutdown_timeout_thread(void); /* The following tries to resolve the classname of a zval of type object. * Since it is slow it should be only used in error messages. */ -#define Z_OBJ_CLASS_NAME_P(obj) (((obj) && (obj)->handlers->get_class_entry != NULL && (obj)->handlers->get_class_entry) ? (obj)->handlers->get_class_entry(obj TSRMLS_CC)->name->val : "") +#define Z_OBJ_CLASS_NAME_P(obj) ((obj) ? (obj)->handlers->get_class_entry(obj TSRMLS_CC)->name->val : "") ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var); diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 26507ad23b..e299741000 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -282,8 +282,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c zend_class_entry *ce_it; zend_user_it_new_iterator(ce, object, &iterator TSRMLS_CC); - ce_it = (Z_TYPE(iterator) == IS_OBJECT && - Z_OBJ_HT(iterator)->get_class_entry) ? Z_OBJCE(iterator) : NULL; + ce_it = (Z_TYPE(iterator) == IS_OBJECT) ? Z_OBJCE(iterator) : NULL; if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) { if (!EG(exception)) { diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 02c2b10268..9b7e579ea3 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -1230,7 +1230,6 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st } if (ce->__call && Z_OBJ(EG(current_execute_data)->This) && - Z_OBJ_HT(EG(current_execute_data)->This)->get_class_entry && instanceof_function(Z_OBJCE(EG(current_execute_data)->This), ce TSRMLS_CC)) { return zend_get_user_call_function(ce, function_name); } else if (ce->__callstatic) { diff --git a/Zend/zend_object_handlers.h b/Zend/zend_object_handlers.h index bc8500c3ec..14b13be308 100644 --- a/Zend/zend_object_handlers.h +++ b/Zend/zend_object_handlers.h @@ -166,10 +166,6 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC); ZEND_API void rebuild_object_properties(zend_object *zobj); - -#define IS_ZEND_STD_OBJECT(z) (Z_TYPE(z) == IS_OBJECT && (Z_OBJ_HT((z))->get_class_entry != NULL)) -#define HAS_CLASS_ENTRY(z) (Z_OBJ_HT(z)->get_class_entry != NULL) - ZEND_API int zend_check_private(union _zend_function *fbc, zend_class_entry *ce, zend_string *function_name TSRMLS_DC); ZEND_API int zend_check_protected(zend_class_entry *ce, zend_class_entry *scope); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 2948b2e100..95300208c4 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2310,8 +2310,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -4436,13 +4435,8 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref); } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { - if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) { - zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); - ZEND_VM_JMP(opline->op2.jmp_addr); - } - ce = Z_OBJCE_P(array_ptr); - if (!ce || ce->get_iterator == NULL) { + if (ce->get_iterator == NULL) { Z_ADDREF_P(array_ptr); } array_ref = array_ptr; @@ -4466,7 +4460,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY) } } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); - if (!ce || !ce->get_iterator) { + if (!ce->get_iterator) { if (OP1_TYPE == IS_CV) { Z_ADDREF_P(array_ref); } @@ -5342,7 +5336,7 @@ ZEND_VM_HANDLER(138, ZEND_INSTANCEOF, TMP|VAR|CV, ANY) SAVE_OPLINE(); expr = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); - if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { + if (Z_TYPE_P(expr) == IS_OBJECT) { result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC); } else { result = 0; @@ -5977,16 +5971,12 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY) break; case IS_OBJECT: if (Z_TYPE_P(value) == opline->extended_value) { - if (Z_OBJ_HT_P(value)->get_class_entry == NULL) { - ZVAL_TRUE(EX_VAR(opline->result.var)); + zend_class_entry *ce = Z_OBJCE_P(value); + if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 + && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { + ZVAL_FALSE(EX_VAR(opline->result.var)); } else { - zend_class_entry *ce = Z_OBJCE_P(value); - if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 - && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { - ZVAL_FALSE(EX_VAR(opline->result.var)); - } else { - ZVAL_TRUE(EX_VAR(opline->result.var)); - } + ZVAL_TRUE(EX_VAR(opline->result.var)); } } else { ZVAL_FALSE(EX_VAR(opline->result.var)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index fdbab5e2f9..eaf5963342 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3082,13 +3082,8 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref); } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { - if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) { - zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); - ZEND_VM_JMP(opline->op2.jmp_addr); - } - ce = Z_OBJCE_P(array_ptr); - if (!ce || ce->get_iterator == NULL) { + if (ce->get_iterator == NULL) { Z_ADDREF_P(array_ptr); } array_ref = array_ptr; @@ -3112,7 +3107,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A } } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); - if (!ce || !ce->get_iterator) { + if (!ce->get_iterator) { if (IS_CONST == IS_CV) { Z_ADDREF_P(array_ref); } @@ -3426,16 +3421,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER break; case IS_OBJECT: if (Z_TYPE_P(value) == opline->extended_value) { - if (Z_OBJ_HT_P(value)->get_class_entry == NULL) { - ZVAL_TRUE(EX_VAR(opline->result.var)); + zend_class_entry *ce = Z_OBJCE_P(value); + if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 + && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { + ZVAL_FALSE(EX_VAR(opline->result.var)); } else { - zend_class_entry *ce = Z_OBJCE_P(value); - if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 - && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { - ZVAL_FALSE(EX_VAR(opline->result.var)); - } else { - ZVAL_TRUE(EX_VAR(opline->result.var)); - } + ZVAL_TRUE(EX_VAR(opline->result.var)); } } else { ZVAL_FALSE(EX_VAR(opline->result.var)); @@ -4180,8 +4171,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -5503,8 +5493,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -6698,8 +6687,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -7644,8 +7632,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -8633,8 +8620,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -9913,13 +9899,8 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref); } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { - if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) { - zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); - ZEND_VM_JMP(opline->op2.jmp_addr); - } - ce = Z_OBJCE_P(array_ptr); - if (!ce || ce->get_iterator == NULL) { + if (ce->get_iterator == NULL) { Z_ADDREF_P(array_ptr); } array_ref = array_ptr; @@ -9943,7 +9924,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); - if (!ce || !ce->get_iterator) { + if (!ce->get_iterator) { if (IS_TMP_VAR == IS_CV) { Z_ADDREF_P(array_ref); } @@ -10222,7 +10203,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A SAVE_OPLINE(); expr = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { + if (Z_TYPE_P(expr) == IS_OBJECT) { result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC); } else { result = 0; @@ -10294,16 +10275,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_A break; case IS_OBJECT: if (Z_TYPE_P(value) == opline->extended_value) { - if (Z_OBJ_HT_P(value)->get_class_entry == NULL) { - ZVAL_TRUE(EX_VAR(opline->result.var)); + zend_class_entry *ce = Z_OBJCE_P(value); + if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 + && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { + ZVAL_FALSE(EX_VAR(opline->result.var)); } else { - zend_class_entry *ce = Z_OBJCE_P(value); - if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 - && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { - ZVAL_FALSE(EX_VAR(opline->result.var)); - } else { - ZVAL_TRUE(EX_VAR(opline->result.var)); - } + ZVAL_TRUE(EX_VAR(opline->result.var)); } } else { ZVAL_FALSE(EX_VAR(opline->result.var)); @@ -16644,13 +16621,8 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref); } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { - if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) { - zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); - ZEND_VM_JMP(opline->op2.jmp_addr); - } - ce = Z_OBJCE_P(array_ptr); - if (!ce || ce->get_iterator == NULL) { + if (ce->get_iterator == NULL) { Z_ADDREF_P(array_ptr); } array_ref = array_ptr; @@ -16674,7 +16646,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG } } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); - if (!ce || !ce->get_iterator) { + if (!ce->get_iterator) { if (IS_VAR == IS_CV) { Z_ADDREF_P(array_ref); } @@ -17181,7 +17153,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A SAVE_OPLINE(); expr = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { + if (Z_TYPE_P(expr) == IS_OBJECT) { result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC); } else { result = 0; @@ -17253,16 +17225,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_A break; case IS_OBJECT: if (Z_TYPE_P(value) == opline->extended_value) { - if (Z_OBJ_HT_P(value)->get_class_entry == NULL) { - ZVAL_TRUE(EX_VAR(opline->result.var)); + zend_class_entry *ce = Z_OBJCE_P(value); + if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 + && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { + ZVAL_FALSE(EX_VAR(opline->result.var)); } else { - zend_class_entry *ce = Z_OBJCE_P(value); - if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 - && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { - ZVAL_FALSE(EX_VAR(opline->result.var)); - } else { - ZVAL_TRUE(EX_VAR(opline->result.var)); - } + ZVAL_TRUE(EX_VAR(opline->result.var)); } } else { ZVAL_FALSE(EX_VAR(opline->result.var)); @@ -18883,8 +18851,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -21142,8 +21109,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -23369,8 +23335,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -24844,8 +24809,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -26788,8 +26752,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ GC_REFCOUNT(object)++; } if (!object || - (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { @@ -34294,13 +34257,8 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref); } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { - if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) { - zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class"); - ZEND_VM_JMP(opline->op2.jmp_addr); - } - ce = Z_OBJCE_P(array_ptr); - if (!ce || ce->get_iterator == NULL) { + if (ce->get_iterator == NULL) { Z_ADDREF_P(array_ptr); } array_ref = array_ptr; @@ -34324,7 +34282,7 @@ static int ZEND_FASTCALL ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS } } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); - if (!ce || !ce->get_iterator) { + if (!ce->get_iterator) { if (IS_CV == IS_CV) { Z_ADDREF_P(array_ref); } @@ -34587,7 +34545,7 @@ static int ZEND_FASTCALL ZEND_INSTANCEOF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR SAVE_OPLINE(); expr = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); - if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->get_class_entry) { + if (Z_TYPE_P(expr) == IS_OBJECT) { result = instanceof_function(Z_OBJCE_P(expr), Z_CE_P(EX_VAR(opline->op2.var)) TSRMLS_CC); } else { result = 0; @@ -34659,16 +34617,12 @@ static int ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_AR break; case IS_OBJECT: if (Z_TYPE_P(value) == opline->extended_value) { - if (Z_OBJ_HT_P(value)->get_class_entry == NULL) { - ZVAL_TRUE(EX_VAR(opline->result.var)); + zend_class_entry *ce = Z_OBJCE_P(value); + if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 + && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { + ZVAL_FALSE(EX_VAR(opline->result.var)); } else { - zend_class_entry *ce = Z_OBJCE_P(value); - if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1 - && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) { - ZVAL_FALSE(EX_VAR(opline->result.var)); - } else { - ZVAL_TRUE(EX_VAR(opline->result.var)); - } + ZVAL_TRUE(EX_VAR(opline->result.var)); } } else { ZVAL_FALSE(EX_VAR(opline->result.var)); |