Skip to content

Commit 80873d2

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix trailing if element JMP lineno
2 parents c7e9d80 + a5e89c5 commit 80873d2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Implement GH-10024 (support linting multiple files at once using php -l).
77
(nielsdos)
88

9+
- Core:
10+
. Fixed line number of JMP instruction over else block. (ilutov)
11+
912
06 Jul 2023, PHP 8.3.0alpha3
1013

1114
- Core:

Zend/zend_compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5567,6 +5567,9 @@ static void zend_compile_if(zend_ast *ast) /* {{{ */
55675567
zend_compile_stmt(stmt_ast);
55685568

55695569
if (i != list->children - 1) {
5570+
/* Set the lineno of JMP to the position of the if keyword, as we don't want to
5571+
* report the last line in the if branch as covered if it hasn't actually executed. */
5572+
CG(zend_lineno) = elem_ast->lineno;
55705573
jmp_opnums[i] = zend_emit_jump(0);
55715574
}
55725575
zend_update_jump_target_to_next(opnum_jmpz);

0 commit comments

Comments
 (0)