diff --git a/Zend/tests/inheritance/argument_restriction_001.phpt b/Zend/tests/inheritance/argument_restriction_001.phpt index 2c54636a58178..ad83f8fff538f 100644 --- a/Zend/tests/inheritance/argument_restriction_001.phpt +++ b/Zend/tests/inheritance/argument_restriction_001.phpt @@ -13,4 +13,4 @@ class Sub extends Base { } ?> --EXPECTF-- -Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = null, $extra = 'llllllllll...') in %s on line %d +Fatal error: Declaration of Sub::&test() must be compatible with Base::&test($foo, array $bar, $option = null, $extra = 'llllllllll...') in %s on line %d diff --git a/Zend/tests/objects/objects_005.phpt b/Zend/tests/objects/objects_005.phpt index 9b9a41465f95b..080b54012ce4d 100644 --- a/Zend/tests/objects/objects_005.phpt +++ b/Zend/tests/objects/objects_005.phpt @@ -19,4 +19,4 @@ class test3 extends test { ?> --EXPECTF-- -Fatal error: Declaration of test3::foo() must be compatible with & test::foo() in %s on line %d +Fatal error: Declaration of test3::foo() must be compatible with test::&foo() in %s on line %d diff --git a/Zend/tests/property_hooks/get_by_ref_implemented_by_val.phpt b/Zend/tests/property_hooks/get_by_ref_implemented_by_val.phpt index 84eb968263546..e12c3db4d6d76 100644 --- a/Zend/tests/property_hooks/get_by_ref_implemented_by_val.phpt +++ b/Zend/tests/property_hooks/get_by_ref_implemented_by_val.phpt @@ -15,4 +15,4 @@ class A implements I { ?> --EXPECTF-- -Fatal error: Declaration of A::$prop::get() must be compatible with & I::$prop::get() in %s on line %d +Fatal error: Declaration of A::$prop::get() must be compatible with I::&$prop::get() in %s on line %d diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index a2da64b62c0d5..c4557d5862896 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -915,10 +915,6 @@ static ZEND_COLD zend_string *zend_get_function_declaration( { smart_str str = {0}; - if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) { - smart_str_appends(&str, "& "); - } - if (fptr->common.scope) { if (fptr->common.scope->ce_flags & ZEND_ACC_ANON_CLASS) { /* cut off on NULL byte ... class@anonymous */ @@ -929,6 +925,10 @@ static ZEND_COLD zend_string *zend_get_function_declaration( smart_str_appends(&str, "::"); } + if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) { + smart_str_appendc(&str, '&'); + } + smart_str_append(&str, fptr->common.function_name); smart_str_appendc(&str, '(');