Skip to content

Fix trailing if element JMP lineno #11598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5408,6 +5408,9 @@ static void zend_compile_if(zend_ast *ast) /* {{{ */
zend_compile_stmt(stmt_ast);

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