diff --git a/.travis.yml b/.travis.yml index d149772e3144c..07653040dd9a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,4 +29,4 @@ before_script: - . ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php -script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff +script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120 diff --git a/NEWS b/NEWS index 5ec672eeda0e4..37db7e6c40857 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,8 @@ PHP NEWS scaling methods. (Pierre) - OPcache: + . Fixed bug #65665 (Exception not properly caught when opcache enabled). + (Laruence) . Fixed bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var). (Dmitry) - SPL: diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 43ae30419fee9..1c34cffbf76e7 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1283,11 +1283,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array) /* adjust exception jump targets */ if (op_array->last_try_catch) { - int i; - for (i = 0; i< op_array->last_try_catch; i++) { - op_array->try_catch_array[i].try_op = cfg->try[i]->start_opline - new_opcodes; - op_array->try_catch_array[i].catch_op = cfg->catch[i]->start_opline - new_opcodes; + int i, j; + for (i = 0, j = 0; i< op_array->last_try_catch; i++) { + if (cfg->try[i]->access) { + op_array->try_catch_array[j].try_op = cfg->try[i]->start_opline - new_opcodes; + op_array->try_catch_array[j].catch_op = cfg->catch[i]->start_opline - new_opcodes; + j++; + } } + op_array->last_try_catch = j; efree(cfg->try); efree(cfg->catch); } diff --git a/ext/opcache/tests/bug65665.phpt b/ext/opcache/tests/bug65665.phpt new file mode 100644 index 0000000000000..ac5c18dd83545 --- /dev/null +++ b/ext/opcache/tests/bug65665.phpt @@ -0,0 +1,118 @@ +--TEST-- +Bug #65665 (Exception not properly caught when opcache enabled) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--SKIPIF-- + +--FILE-- + +--FILE-- + +--EXPECT-- +bool(false) +string(4) "okey"