Skip to content

Commit 7c9c395

Browse files
authored
zend_inheritance: Improve formatting of return-by-ref & in zend_get_function_declaration() (php#20104)
The space after `&` made it look like the `&` was not part of the signature, possibly leading to confusion why the two signatures are incompatible without carefully reading the message.
1 parent 0fcd0be commit 7c9c395

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Zend/tests/inheritance/argument_restriction_001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ class Sub extends Base {
1313
}
1414
?>
1515
--EXPECTF--
16-
Fatal error: Declaration of & Sub::test() must be compatible with & Base::test($foo, array $bar, $option = null, $extra = 'llllllllll...') in %s on line %d
16+
Fatal error: Declaration of &Sub::test() must be compatible with &Base::test($foo, array $bar, $option = null, $extra = 'llllllllll...') in %s on line %d

Zend/tests/objects/objects_005.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ class test3 extends test {
1919

2020
?>
2121
--EXPECTF--
22-
Fatal error: Declaration of test3::foo() must be compatible with & test::foo() in %s on line %d
22+
Fatal error: Declaration of test3::foo() must be compatible with &test::foo() in %s on line %d

Zend/tests/property_hooks/get_by_ref_implemented_by_val.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ class A implements I {
1515

1616
?>
1717
--EXPECTF--
18-
Fatal error: Declaration of A::$prop::get() must be compatible with & I::$prop::get() in %s on line %d
18+
Fatal error: Declaration of A::$prop::get() must be compatible with &I::$prop::get() in %s on line %d

Zend/zend_inheritance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration(
916916
smart_str str = {0};
917917

918918
if (fptr->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
919-
smart_str_appends(&str, "& ");
919+
smart_str_appendc(&str, '&');
920920
}
921921

922922
if (fptr->common.scope) {

0 commit comments

Comments
 (0)