Skip to content

Instantly share code, notes, and snippets.

@nielsdos
Created June 30, 2025 20:47
Show Gist options
  • Save nielsdos/fe1a4b30aee84efff23f32dc4b0e5ffe to your computer and use it in GitHub Desktop.
Save nielsdos/fe1a4b30aee84efff23f32dc4b0e5ffe to your computer and use it in GitHub Desktop.
diff --git a/Zend/Optimizer/zend_optimizer.c b/Zend/Optimizer/zend_optimizer.c
index 857968e621b..b47be052360 100644
--- a/Zend/Optimizer/zend_optimizer.c
+++ b/Zend/Optimizer/zend_optimizer.c
@@ -966,7 +966,7 @@ static void zend_optimize(zend_op_array *op_array,
}
if (ctx->debug_level & ZEND_DUMP_BEFORE_OPTIMIZER) {
- zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES, "before optimizer", NULL);
+ zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES|ZEND_DUMP_LINE_NUMBERS, "before optimizer", NULL);
}
/* pass 1 (Simple local optimizations)
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 41113e2f005..61dad8f19d8 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5906,6 +5906,7 @@ static void zend_compile_match(znode *result, zend_ast *ast)
zend_ast_list *arms = zend_ast_get_list(ast->child[1]);
bool has_default_arm = 0;
uint32_t opnum_match = (uint32_t)-1;
+ uint32_t old_lineno = CG(zend_lineno);
znode expr_node;
zend_compile_expr(&expr_node, expr_ast);
@@ -6084,6 +6085,8 @@ static void zend_compile_match(znode *result, zend_ast *ast)
efree(jmpnz_opnums);
}
efree(jmp_end_opnums);
+
+ CG(zend_lineno) = old_lineno;
}
static void zend_compile_try(zend_ast *ast) /* {{{ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment