@@ -1998,27 +1998,17 @@ ZEND_API void zend_do_link_class(zend_class_entry *ce, zend_class_entry *parent)
1998
1998
1999
1999
static void _inheritance_runtime_error_msg (zend_function * child , zend_function * parent )
2000
2000
{
2001
- int error_level ;
2002
- const char * error_verb ;
2003
- zend_string * method_prototype = zend_get_function_declaration (parent );
2004
- zend_string * child_prototype = zend_get_function_declaration (child );
2005
-
2006
- if (child -> common .prototype && (
2007
- child -> common .prototype -> common .fn_flags & ZEND_ACC_ABSTRACT
2008
- )) {
2009
- error_level = E_ERROR ;
2010
- error_verb = "must" ;
2011
- } else if ((parent -> common .fn_flags & ZEND_ACC_HAS_RETURN_TYPE ) &&
2012
- !_check_inherited_return_type (child , child -> common .arg_info - 1 , parent , parent -> common .arg_info - 1 )) {
2013
- error_level = E_ERROR ;
2014
- error_verb = "must" ;
2015
- } else {
2016
- error_level = E_WARNING ;
2017
- error_verb = "should" ;
2001
+ zend_function * proto = child -> common .prototype ;
2002
+ if ((proto && (proto -> common .fn_flags & ZEND_ACC_ABSTRACT ))
2003
+ || ((parent -> common .fn_flags & ZEND_ACC_HAS_RETURN_TYPE )
2004
+ && !_check_inherited_return_type (child , child -> common .arg_info - 1 , parent , parent -> common .arg_info - 1 )))
2005
+ {
2006
+ zend_string * method_prototype = zend_get_function_declaration (parent );
2007
+ zend_string * child_prototype = zend_get_function_declaration (child );
2008
+ zend_error (E_ERROR , "Declaration of %s must be compatible with %s" , ZSTR_VAL (child_prototype ), ZSTR_VAL (method_prototype ));
2009
+ zend_string_efree (child_prototype );
2010
+ zend_string_efree (method_prototype );
2018
2011
}
2019
- zend_error (error_level , "Declaration of %s %s be compatible with %s" , ZSTR_VAL (child_prototype ), error_verb , ZSTR_VAL (method_prototype ));
2020
- zend_string_efree (child_prototype );
2021
- zend_string_efree (method_prototype );
2022
2012
}
2023
2013
2024
2014
ZEND_API void zend_verify_variance (zend_class_entry * ce ) /* {{{ */
@@ -2093,7 +2083,9 @@ ZEND_API void zend_verify_variance(zend_class_entry *ce) /* {{{ */
2093
2083
parent , parent_arg_info );
2094
2084
2095
2085
if (check < 0 ) {
2096
- zend_error_noreturn (E_ERROR , "Bad arg!" );
2086
+ _inheritance_runtime_error_msg (child , parent );
2087
+ // todo: what to do with errors, not warnings?
2088
+ continue ;
2097
2089
}
2098
2090
}
2099
2091
0 commit comments