Merge branch 'PHP-8.2' into PHP-8.3

* PHP-8.2:
  Fix lineno in function redeclaration error
This commit is contained in:
Ilija Tovilo 2024-10-22 15:05:29 +02:00
commit 381e020edb
No known key found for this signature in database
GPG key ID: 5050C66BFCD1015A
5 changed files with 24 additions and 3 deletions

View file

@ -175,13 +175,13 @@ failure:
function2 = Z_PTR_P(t);
CG(in_compilation) = 1;
zend_set_compiled_filename(function1->op_array.filename);
CG(zend_lineno) = function1->op_array.opcodes[0].lineno;
CG(zend_lineno) = function1->op_array.line_start;
if (function2->type == ZEND_USER_FUNCTION
&& function2->op_array.last > 0) {
zend_error(E_ERROR, "Cannot redeclare %s() (previously declared in %s:%d)",
ZSTR_VAL(function1->common.function_name),
ZSTR_VAL(function2->op_array.filename),
(int)function2->op_array.opcodes[0].lineno);
(int)function2->op_array.line_start);
} else {
zend_error(E_ERROR, "Cannot redeclare %s()", ZSTR_VAL(function1->common.function_name));
}