Skip to content

Commit c019674

Browse files
committed
Adjust lineno for promoted properties
Fixes GH-19081
1 parent f11ea2a commit c019674

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Zend/tests/ctor_promotion/ctor_promotion_callable_type.phpt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ Type of promoted property may not be callable
44
<?php
55

66
class Test {
7-
public function __construct(public callable $callable) {}
7+
public function __construct(
8+
public callable $callable
9+
) {}
810
}
911

1012
?>
1113
--EXPECTF--
12-
Fatal error: Property Test::$callable cannot have type callable in %s on line %d
14+
Fatal error: Property Test::$callable cannot have type callable in %s on line 5

Zend/zend_compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7683,6 +7683,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
76837683
uint32_t property_flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY | ZEND_ACC_FINAL);
76847684
bool is_promoted = property_flags || hooks_ast;
76857685

7686+
CG(zend_lineno) = param_ast->lineno;
7687+
76867688
znode var_node, default_node;
76877689
uint8_t opcode;
76887690
zend_op *opline;

0 commit comments

Comments
 (0)