Skip to content

Commit 609385b

Browse files
committed
Fixed bug #76446 (zend_variables.c:73: zend_string_destroy: Assertion `!(zval_gc_flags((str)->gc)).
1 parent 1650e46 commit 609385b

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ PHP NEWS
1717

1818
- Opcache:
1919
. Fixed bug #76463 (var has array key type but not value type). (Laruence)
20+
. Fixed bug #76446 (zend_variables.c:73: zend_string_destroy: Assertion
21+
`!(zval_gc_flags((str)->gc)). (Nikita, Laruence)
2022

2123
- ZIP:
2224
. Fixed bug #76461 (OPSYS_Z_CPM defined instead of OPSYS_CPM).

ext/opcache/Optimizer/dce.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* postdominator tree and of postdominance frontiers, which does not seem worthwhile at this
4040
* point.
4141
* * We separate intrinsic side-effects from potential side-effects in the form of notices thrown
42-
* by the instruction (in case we want to make this configurable). See may_have_side_effect() and
42+
* by the instruction (in case we want to make this configurable). See may_have_side_effects() and
4343
* zend_may_throw().
4444
* * We often cannot DCE assignments and unsets while guaranteeing that dtors run in the same
4545
* order. There is an optimization option to allow reordering of dtor effects.
@@ -109,7 +109,6 @@ static inline zend_bool may_have_side_effects(
109109
case ZEND_CAST:
110110
case ZEND_ROPE_INIT:
111111
case ZEND_ROPE_ADD:
112-
case ZEND_ROPE_END:
113112
case ZEND_INIT_ARRAY:
114113
case ZEND_ADD_ARRAY_ELEMENT:
115114
case ZEND_SPACESHIP:
@@ -127,6 +126,9 @@ static inline zend_bool may_have_side_effects(
127126
case ZEND_FUNC_GET_ARGS:
128127
/* No side effects */
129128
return 0;
129+
case ZEND_ROPE_END:
130+
/* TODO: Rope dce optmization, see #76446 */
131+
return 1;
130132
case ZEND_JMP:
131133
case ZEND_JMPZ:
132134
case ZEND_JMPNZ:

ext/opcache/tests/bug76446.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #76446 (zend_variables.c:73: zend_string_destroy: Assertion `!(zval_gc_flags((str)->gc)
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 test()
12+
{
13+
$openmenu = '';
14+
$openstr2 = "&amp;openmenu={$openmenu}{$addlang}\"";
15+
return 0;
16+
}
17+
18+
var_dump(test());
19+
?>
20+
--EXPECTF--
21+
Notice: Undefined variable: addlang in %sbug76446.php on line %d
22+
int(0)

0 commit comments

Comments
 (0)