Skip to content

Commit f674035

Browse files
committed
Correct lineno for runtime variance error
1 parent 40dea03 commit f674035

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Zend/tests/type_declarations/variance/parent_in_class.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ class B4 extends A4 {
4242
--EXPECTF--
4343
Warning: Declaration of B4::method(A4 $x) should be compatible with A4::method(P4 $x) in %s on line 36
4444

45-
Warning: Declaration of B::method(A $x) should be compatible with A::method(parent $x) in %s on line 36
45+
Warning: Declaration of B::method(A $x) should be compatible with A::method(parent $x) in %s on line 8

Zend/zend_inheritance.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2155,9 +2155,11 @@ static void _inheritance_runtime_error_msg(zend_function *child, zend_function *
21552155
verb = "must";
21562156
}
21572157
{
2158+
ZEND_ASSERT(child->type == ZEND_USER_FUNCTION);
21582159
zend_string *method_prototype = zend_get_function_declaration(parent);
21592160
zend_string *child_prototype = zend_get_function_declaration(child);
2160-
zend_error(level, "Declaration of %s %s be compatible with %s",
2161+
zend_error_at(level, NULL, child->op_array.line_start,
2162+
"Declaration of %s %s be compatible with %s",
21612163
ZSTR_VAL(child_prototype), verb, ZSTR_VAL(method_prototype));
21622164
zend_string_efree(child_prototype);
21632165
zend_string_efree(method_prototype);

0 commit comments

Comments
 (0)