File tree 3 files changed +38
-4
lines changed
3 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -49636,11 +49636,16 @@ ZEND_API int zend_vm_call_opcode_handler(zend_execute_data* ex)
49636
49636
LOAD_OPLINE();
49637
49637
#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)
49638
49638
((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
49639
- ret = opline? ((execute_data != ex)? (int)(execute_data->prev_execute_data != ex) + 1 : 0) : -1;
49639
+ if (EXPECTED(opline)) {
49640
+ ret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0;
49641
+ SAVE_OPLINE();
49642
+ } else {
49643
+ ret = -1;
49644
+ }
49640
49645
#else
49641
49646
ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
49642
- #endif
49643
49647
SAVE_OPLINE();
49648
+ #endif
49644
49649
#ifdef ZEND_VM_FP_GLOBAL_REG
49645
49650
execute_data = orig_execute_data;
49646
49651
#endif
Original file line number Diff line number Diff line change @@ -1618,11 +1618,16 @@ function gen_vm($def, $skel) {
1618
1618
out ($ f , "\tLOAD_OPLINE(); \n" );
1619
1619
out ($ f ,"#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG) \n" );
1620
1620
out ($ f , "\t((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \n" );
1621
- out ($ f , "\tret = opline? ((execute_data != ex)? (int)(execute_data->prev_execute_data != ex) + 1 : 0) : -1; \n" );
1621
+ out ($ f , "\tif (EXPECTED(opline)) { \n" );
1622
+ out ($ f , "\t\tret = execute_data != ex ? (int)(execute_data->prev_execute_data != ex) + 1 : 0; \n" );
1623
+ out ($ f , "\t\tSAVE_OPLINE(); \n" );
1624
+ out ($ f , "\t} else { \n" );
1625
+ out ($ f , "\t\tret = -1; \n" );
1626
+ out ($ f , "\t} \n" );
1622
1627
out ($ f , "#else \n" );
1623
1628
out ($ f , "\tret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); \n" );
1624
- out ($ f , "#endif \n" );
1625
1629
out ($ f , "\tSAVE_OPLINE(); \n" );
1630
+ out ($ f , "#endif \n" );
1626
1631
out ($ f , "#ifdef ZEND_VM_FP_GLOBAL_REG \n" );
1627
1632
out ($ f , "\texecute_data = orig_execute_data; \n" );
1628
1633
out ($ f , "#endif \n" );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Ensure proper saving of EX(opline)
3
+ --PHPDBG--
4
+ r
5
+ q
6
+ --EXPECTF--
7
+ [Successful compilation of %s]
8
+ prompt> caught Generator exception
9
+ [Script ended normally]
10
+ prompt>
11
+ --FILE--
12
+ <?php
13
+
14
+ function gen () {
15
+ try {
16
+ throw new Exception ;
17
+ } catch (Exception $ e ) {
18
+ yield "caught Generator exception " ;
19
+ }
20
+ }
21
+
22
+ foreach (gen () as $ v ) {
23
+ print $ v ;
24
+ }
You can’t perform that action at this time.
0 commit comments