Skip to content

Commit 4758164

Browse files
committed
Fixed bug #76094 (Access violation when using opcache)
1 parent 84881c6 commit 4758164

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Fixed bug #76088 (ODBC functions are not available by default on Windows).
77
(cmb)
88

9+
- Opcache:
10+
. Fixed bug #76094 (Access violation when using opcache). (Laruence)
11+
912
- Standard:
1013
. Fixed bug #74139 (mail.add_x_header default inconsistent with docs). (cmb)
1114

ext/opcache/Optimizer/dce.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ static zend_bool dce_instr(context *ctx, zend_op *opline, zend_ssa_op *ssa_op) {
356356

357357
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR))&& !is_var_dead(ctx, ssa_op->op1_use)) {
358358
if (!try_remove_var_def(ctx, ssa_op->op1_use, ssa_op->op1_use_chain, opline)) {
359-
if (ssa->var_info[ssa_op->op1_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) {
359+
if (ssa->var_info[ssa_op->op1_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)
360+
&& opline->opcode != ZEND_CASE) {
360361
free_var = ssa_op->op1_use;
361362
free_var_type = opline->op1_type;
362363
}

ext/opcache/tests/bug76094.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #76094 (Access violation when using opcache)
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+
function MetaType($t)
12+
{
13+
14+
switch (strtoupper($t)) {
15+
case PHP_INT_MAX :
16+
return 1;
17+
case 0:
18+
default:
19+
return 0;
20+
}
21+
}
22+
23+
var_dump(MetaType("aa"));
24+
?>
25+
--EXPECT--
26+
int(0)

0 commit comments

Comments
 (0)