@@ -317,6 +317,7 @@ void zend_oparray_context_begin(zend_oparray_context *prev_context) /* {{{ */
317
317
CG (context ).brk_cont_array = NULL ;
318
318
CG (context ).labels = NULL ;
319
319
CG (context ).has_unfinished_calls = false;
320
+ CG (context ).in_block_expr = false;
320
321
}
321
322
/* }}} */
322
323
@@ -5350,11 +5351,13 @@ static void zend_compile_throw(znode *result, zend_ast *ast) /* {{{ */
5350
5351
zend_compile_expr (& expr_node , expr_ast );
5351
5352
5352
5353
zend_op * opline = zend_emit_op (NULL , ZEND_THROW , & expr_node , NULL );
5353
- if (result ) {
5354
+ if (result || CG ( context ). in_block_expr ) {
5354
5355
/* Mark this as an "expression throw" for opcache. */
5355
5356
opline -> extended_value = ZEND_THROW_IS_EXPR ;
5356
- result -> op_type = IS_CONST ;
5357
- ZVAL_TRUE (& result -> u .constant );
5357
+ if (result ) {
5358
+ result -> op_type = IS_CONST ;
5359
+ ZVAL_TRUE (& result -> u .constant );
5360
+ }
5358
5361
}
5359
5362
}
5360
5363
/* }}} */
@@ -6139,7 +6142,7 @@ static void zend_compile_match(znode *result, zend_ast *ast)
6139
6142
if (opline -> op1_type == IS_CONST ) {
6140
6143
Z_TRY_ADDREF_P (CT_CONSTANT (opline -> op1 ));
6141
6144
}
6142
- if (arms -> children == 0 ) {
6145
+ if (arms -> children == 0 || CG ( context ). in_block_expr ) {
6143
6146
/* Mark this as an "expression throw" for opcache. */
6144
6147
opline -> extended_value = ZEND_THROW_IS_EXPR ;
6145
6148
}
@@ -6188,8 +6191,11 @@ static void zend_compile_match(znode *result, zend_ast *ast)
6188
6191
6189
6192
znode body_node ;
6190
6193
if (body_ast -> kind == ZEND_AST_MATCH_ARM_BLOCK ) {
6194
+ bool prev_in_block_expr = CG (context ).in_block_expr ;
6195
+ CG (context ).in_block_expr = true;
6191
6196
zend_compile_stmt_list (body_ast -> child [0 ]);
6192
6197
zend_compile_expr (& body_node , body_ast -> child [1 ]);
6198
+ CG (context ).in_block_expr = prev_in_block_expr ;
6193
6199
} else {
6194
6200
zend_compile_expr (& body_node , body_ast );
6195
6201
}
@@ -9633,11 +9639,13 @@ static void zend_compile_exit(znode *result, zend_ast *ast) /* {{{ */
9633
9639
}
9634
9640
9635
9641
zend_op * opline = zend_emit_op (NULL , ZEND_EXIT , & expr_node , NULL );
9636
- if (result ) {
9642
+ if (result || CG ( context ). in_block_expr ) {
9637
9643
/* Mark this as an "expression throw" for opcache. */
9638
9644
opline -> extended_value = ZEND_THROW_IS_EXPR ;
9639
- result -> op_type = IS_CONST ;
9640
- ZVAL_TRUE (& result -> u .constant );
9645
+ if (result ) {
9646
+ result -> op_type = IS_CONST ;
9647
+ ZVAL_TRUE (& result -> u .constant );
9648
+ }
9641
9649
}
9642
9650
}
9643
9651
/* }}} */
0 commit comments