Ignore:
Timestamp:
2013-09-26T09:14:42+02:00 (15 months ago)
Author:
moo
Message:

fix optimizer for try/catch/finally when either catch/finally is omitted

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mod_optimizer/xc_optimizer.c

    r1351 r1398  
    494494        zend_uint j; 
    495495        zend_try_catch_element *e = &op_array->try_catch_array[i]; 
    496         for (j = e->try_op; j < e->catch_op; j ++) { 
    497             oplineinfos[j].catchbbid = oplineinfos[e->catch_op].bbid; 
    498 #   ifdef ZEND_ENGINE_2_5 
    499             oplineinfos[j].finallybbid = oplineinfos[e->finally_op].bbid; 
     496        zend_uint end = e->catch_op != 0 ? e->catch_op : e->finally_op; 
     497        for (j = e->try_op; j < end; j ++) { 
     498            oplineinfos[j].catchbbid   = e->catch_op   == 0 ? BBID_INVALID : oplineinfos[e->catch_op  ].bbid; 
     499#   ifdef ZEND_ENGINE_2_5 
     500            oplineinfos[j].finallybbid = e->finally_op == 0 ? BBID_INVALID : oplineinfos[e->finally_op].bbid; 
    500501#   endif 
    501502        } 
     
    610611            if (bb->catch != BBID_INVALID 
    611612#   ifdef ZEND_ENGINE_2_5 
    612              && bb->finally != BBID_INVALID 
     613             || bb->finally != BBID_INVALID 
    613614#   endif 
    614615            ) { 
    615616                zend_uint try_op = bbs_get(bbs, bbid)->opnum; 
    616                 zend_uint catch_op = bbs_get(bbs, bb->catch)->opnum; 
    617 #   ifdef ZEND_ENGINE_2_5 
    618                 zend_uint finally_op = bbs_get(bbs, bb->finally)->opnum; 
     617                zend_uint catch_op   = bb->catch   == BBID_INVALID ? 0 : bbs_get(bbs, bb->catch )->opnum; 
     618#   ifdef ZEND_ENGINE_2_5 
     619                zend_uint finally_op = bb->finally == BBID_INVALID ? 0 : bbs_get(bbs, bb->finally)->opnum; 
    619620#   endif 
    620621 
Note: See TracChangeset for help on using the changeset viewer.