Skip to content

Commit e06a712

Browse files
committed
Merge branch 'PHP-5.5' of https://git.php.net/repository/php-src into 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)
2 parents d52dbd5 + b5283b9 commit e06a712

File tree

5 files changed

+145
-5
lines changed

5 files changed

+145
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ before_script:
2929
- . ./travis/ext/pdo_pgsql/setup.sh
3030

3131
# Run PHPs run-tests.php
32-
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff
32+
script: ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PHP NEWS
1717
scaling methods. (Pierre)
1818

1919
- OPcache:
20+
. Fixed bug #65665 (Exception not properly caught when opcache enabled).
21+
(Laruence)
2022
. Fixed bug #65510 (5.5.2 crashes in _get_zval_ptr_ptr_var). (Dmitry)
2123

2224
- SPL:

ext/opcache/Optimizer/block_pass.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,11 +1283,15 @@ static void assemble_code_blocks(zend_cfg *cfg, zend_op_array *op_array)
12831283

12841284
/* adjust exception jump targets */
12851285
if (op_array->last_try_catch) {
1286-
int i;
1287-
for (i = 0; i< op_array->last_try_catch; i++) {
1288-
op_array->try_catch_array[i].try_op = cfg->try[i]->start_opline - new_opcodes;
1289-
op_array->try_catch_array[i].catch_op = cfg->catch[i]->start_opline - new_opcodes;
1286+
int i, j;
1287+
for (i = 0, j = 0; i< op_array->last_try_catch; i++) {
1288+
if (cfg->try[i]->access) {
1289+
op_array->try_catch_array[j].try_op = cfg->try[i]->start_opline - new_opcodes;
1290+
op_array->try_catch_array[j].catch_op = cfg->catch[i]->start_opline - new_opcodes;
1291+
j++;
1292+
}
12901293
}
1294+
op_array->last_try_catch = j;
12911295
efree(cfg->try);
12921296
efree(cfg->catch);
12931297
}

ext/opcache/tests/bug65665.phpt

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
--TEST--
2+
Bug #65665 (Exception not properly caught when opcache enabled)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
--SKIPIF--
7+
<?php require_once('skipif.inc'); ?>
8+
--FILE--
9+
<?php
10+
function foo() {
11+
try
12+
{
13+
switch (1)
14+
{
15+
case 0:
16+
try
17+
{
18+
19+
}
20+
catch (Exception $e)
21+
{
22+
23+
}
24+
25+
break;
26+
27+
case 1:
28+
try
29+
{
30+
throw new Exception('aaa');
31+
}
32+
catch (Exception $e)
33+
{
34+
echo "correct\n";
35+
}
36+
37+
break;
38+
}
39+
}
40+
catch (Exception $e)
41+
{
42+
echo "wrong\n";
43+
}
44+
return;
45+
}
46+
47+
function foo1() {
48+
try
49+
{
50+
switch (1)
51+
{
52+
case 0:
53+
try
54+
{
55+
56+
}
57+
catch (Exception $e)
58+
{
59+
dummy:
60+
echo "ect\n";
61+
}
62+
63+
break;
64+
65+
case 1:
66+
try
67+
{
68+
throw new Exception('aaa');
69+
}
70+
catch (Exception $e)
71+
{
72+
echo "corr";
73+
goto dummy;
74+
}
75+
break;
76+
}
77+
}
78+
catch (Exception $e)
79+
{
80+
echo "wrong\n";
81+
}
82+
return;
83+
}
84+
85+
function foo2() {
86+
try
87+
{
88+
switch (1)
89+
{
90+
case 0:
91+
try
92+
{
93+
dummy:
94+
throw new Exception('aaa');
95+
}
96+
catch (Exception $e)
97+
{
98+
echo "correct\n";
99+
}
100+
101+
break;
102+
103+
case 1:
104+
goto dummy;
105+
break;
106+
}
107+
}
108+
catch (Exception $e)
109+
{
110+
echo "wrong\n";
111+
}
112+
return;
113+
}
114+
foo();foo1();foo2();
115+
--EXPECT--
116+
correct
117+
correct
118+
correct

ext/opcache/tests/issue0128.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
ISSUE #128 (opcache_invalidate segmentation fault)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
<?php
11+
var_dump(opcache_invalidate('1'));
12+
var_dump("okey");
13+
?>
14+
--EXPECT--
15+
bool(false)
16+
string(4) "okey"

0 commit comments

Comments
 (0)