Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Zend/tests/recv_lineno_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
RECV[_INIT] lineno is function start
--FILE--
<?php

class Foo {
public function __construct(
public $x = FOO,
) {}
}

new Foo();

?>
--EXPECTF--
Fatal error: Uncaught Error: Undefined constant "FOO" in %s:4
Stack trace:
#0 %s(9): Foo->__construct()
#1 {main}
thrown in %s on line 4
5 changes: 3 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7639,7 +7639,7 @@ static bool zend_property_is_virtual(zend_class_entry *ce, zend_string *property
return is_virtual;
}

static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32_t fallback_return_type) /* {{{ */
static void zend_compile_params(zend_ast_decl *func_decl_ast, zend_ast *ast, zend_ast *return_type_ast, uint32_t fallback_return_type) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
uint32_t i;
Expand Down Expand Up @@ -7817,6 +7817,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
opline = zend_emit_op(NULL, opcode, NULL, &default_node);
SET_NODE(opline->result, &var_node);
opline->op1.num = i + 1;
opline->lineno = func_decl_ast->start_lineno;

uint32_t arg_info_flags = _ZEND_ARG_INFO_FLAGS(is_ref, is_variadic, /* is_tentative */ 0)
| (is_promoted ? _ZEND_IS_PROMOTED_BIT : 0);
Expand Down Expand Up @@ -8457,7 +8458,7 @@ static zend_op_array *zend_compile_func_decl_ex(
zend_stack_push(&CG(loop_var_stack), (void *) &dummy_var);
}

zend_compile_params(params_ast, return_type_ast,
zend_compile_params(decl, params_ast, return_type_ast,
is_method && zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME) ? IS_STRING : 0);
if (CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) {
zend_mark_function_as_generator();
Expand Down