Browse Source

- Change prototype isA check not to check the constructor.

- Only give an E_STRICT for non-isA compliant code as opposed to
  E_COMPILE_ERROR.
PEAR_1_4DEV
Andi Gutmans 23 years ago
parent
commit
63e263f32a
  1. 27
      Zend/zend_compile.c

27
Zend/zend_compile.c

@ -1713,7 +1713,8 @@ static zend_bool zend_do_perform_implementation_check(zend_function *fe)
zend_uint i;
zend_function *proto = fe->common.prototype;
if (!proto || !proto->common.arg_info) {
/* If it's a user function then arg_info == NULL means we don't have any parameters but we still need to do the arg number checks. We are only willing to ignore this for internal functions because extensions don't always define arg_info. */
if (!proto || (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION)) {
return 1;
}
@ -1814,22 +1815,16 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f
}
}
if (EG(ze1_compatibility_mode)) {
if (parent_flags & ZEND_ACC_ABSTRACT) {
child->common.prototype = parent;
child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
} else {
child->common.prototype = parent->common.prototype;
}
} else {
child->common.prototype = parent;
if (parent_flags & ZEND_ACC_ABSTRACT) {
child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
}
child->common.prototype = parent;
if (parent_flags & ZEND_ACC_ABSTRACT) {
child->common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT;
}
if (!zend_do_perform_implementation_check(child)) {
zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
/* Check E_STRICT before the check so that we save some time */
if(EG(error_reporting) & E_STRICT) {
if (!(child->common.fn_flags & ZEND_ACC_CTOR) && !zend_do_perform_implementation_check(child)) {
zend_error(E_STRICT, "Declaration of %s::%s() must be compatible with that of %s::%s()", ZEND_FN_SCOPE_NAME(child), child->common.function_name, ZEND_FN_SCOPE_NAME(child->common.prototype), child->common.prototype->common.function_name);
}
}
return 0;
@ -3406,7 +3401,7 @@ void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS
do_end_loop(foreach_token->u.opline_num TSRMLS_CC);
zend_stack_top(&CG(foreach_copy_stack), &container_ptr);
zend_stack_top(&CG(foreach_copy_stack), (void **) &container_ptr);
generate_free_foreach_copy(container_ptr TSRMLS_CC);
zend_stack_del_top(&CG(foreach_copy_stack));

Loading…
Cancel
Save