Skip to content

Commit

Permalink
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into…
Browse files Browse the repository at this point in the history
… PHP-5.5

# By Xinchen Hui (2) and Michael Wallner (1)
# Via Michael Wallner
* 'PHP-5.5' of https://git.php.net/repository/php-src:
  double test timeout for travis
  Add test for ISSUE #128
  Fixed bug #65665 (Exception not properly caught when opcache enabled)
  • Loading branch information
cjbj committed Sep 16, 2013
2 parents d52dbd5 + b5283b9 commit e06a712
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 8 additions & 4 deletions ext/opcache/Optimizer/block_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
118 changes: 118 additions & 0 deletions ext/opcache/tests/bug65665.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
--TEST--
Bug #65665 (Exception not properly caught when opcache enabled)
--INI--
opcache.enable=1
opcache.enable_cli=1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function foo() {
try
{
switch (1)
{
case 0:
try
{

}
catch (Exception $e)
{

}

break;

case 1:
try
{
throw new Exception('aaa');
}
catch (Exception $e)
{
echo "correct\n";
}

break;
}
}
catch (Exception $e)
{
echo "wrong\n";
}
return;
}

function foo1() {
try
{
switch (1)
{
case 0:
try
{

}
catch (Exception $e)
{
dummy:
echo "ect\n";
}

break;

case 1:
try
{
throw new Exception('aaa');
}
catch (Exception $e)
{
echo "corr";
goto dummy;
}
break;
}
}
catch (Exception $e)
{
echo "wrong\n";
}
return;
}

function foo2() {
try
{
switch (1)
{
case 0:
try
{
dummy:
throw new Exception('aaa');
}
catch (Exception $e)
{
echo "correct\n";
}

break;

case 1:
goto dummy;
break;
}
}
catch (Exception $e)
{
echo "wrong\n";
}
return;
}
foo();foo1();foo2();
--EXPECT--
correct
correct
correct
16 changes: 16 additions & 0 deletions ext/opcache/tests/issue0128.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
ISSUE #128 (opcache_invalidate segmentation fault)
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
var_dump(opcache_invalidate('1'));
var_dump("okey");
?>
--EXPECT--
bool(false)
string(4) "okey"

0 comments on commit e06a712

Please sign in to comment.