1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix lineno for constructor property promotion errors

Fixes GH-19081
Closes GH-19100
This commit is contained in:
Ilija Tovilo
2025-07-11 21:32:40 +02:00
parent 46213f879a
commit 9460dbe906
3 changed files with 8 additions and 2 deletions

2
NEWS
View File

@@ -83,6 +83,8 @@ PHP NEWS
(DanielEScherzer)
. Do not use RTLD_DEEPBIND if dlmopen is available. (Daniil Gentili)
. Make `clone()` a function. (timwolla, edorian)
. Fixed bug GH-19081 (Wrong lineno in property error with constructor property
promotion). (ilutov)
- Curl:
. Added curl_multi_get_handles(). (timwolla)

View File

@@ -4,9 +4,11 @@ Type of promoted property may not be callable
<?php
class Test {
public function __construct(public callable $callable) {}
public function __construct(
public callable $callable
) {}
}
?>
--EXPECTF--
Fatal error: Property Test::$callable cannot have type callable in %s on line %d
Fatal error: Property Test::$callable cannot have type callable in %s on line 5

View File

@@ -7698,6 +7698,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
uint32_t property_flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY | ZEND_ACC_FINAL);
bool is_promoted = property_flags || hooks_ast;
CG(zend_lineno) = param_ast->lineno;
znode var_node, default_node;
uint8_t opcode;
zend_op *opline;