@@ -516,6 +516,18 @@ static inheritance_status zend_do_perform_arg_type_hint_check(
516
516
}
517
517
/* }}} */
518
518
519
+ static const char * get_arg_name (
520
+ const zend_function * fe , const zend_arg_info * arg_info , size_t * len ) {
521
+ if (fe -> type == ZEND_INTERNAL_FUNCTION ) {
522
+ zend_internal_arg_info * internal_arg_info = (zend_internal_arg_info * ) arg_info ;
523
+ * len = strlen (internal_arg_info -> name );
524
+ return internal_arg_info -> name ;
525
+ } else {
526
+ * len = ZSTR_LEN (arg_info -> name );
527
+ return ZSTR_VAL (arg_info -> name );
528
+ }
529
+ }
530
+
519
531
static inheritance_status zend_do_perform_implementation_check (
520
532
const zend_function * fe , const zend_function * proto ) /* {{{ */
521
533
{
@@ -592,6 +604,20 @@ static inheritance_status zend_do_perform_implementation_check(
592
604
if (ZEND_ARG_SEND_MODE (fe_arg_info ) != ZEND_ARG_SEND_MODE (proto_arg_info )) {
593
605
return INHERITANCE_ERROR ;
594
606
}
607
+
608
+ // TODO: We may get duplicate errors for UNRESOLVED.
609
+ size_t proto_name_len , fe_name_len ;
610
+ const char * proto_name = get_arg_name (proto , proto_arg_info , & proto_name_len );
611
+ const char * fe_name = get_arg_name (fe , fe_arg_info , & fe_name_len );
612
+ if (proto_name_len != fe_name_len || memcmp (proto_name , fe_name , proto_name_len )) {
613
+ zend_error (E_NOTICE ,
614
+ "Parameter $%s of %s::%s() has been renamed to $%s in %s::%s(), "
615
+ "which may break named parameters" ,
616
+ proto_name ,
617
+ ZSTR_VAL (proto -> common .scope -> name ), ZSTR_VAL (proto -> common .function_name ),
618
+ fe_name ,
619
+ ZSTR_VAL (fe -> common .scope -> name ), ZSTR_VAL (fe -> common .function_name ));
620
+ }
595
621
}
596
622
597
623
/* Check return type compatibility, but only if the prototype already specifies
0 commit comments