From b8ffa3707c07e6edbe5db5a3fdf5516ba1f6bef0 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 20 Sep 2018 12:33:46 +0300 Subject: [PATCH] Fixed bug #76711 (OPcache enabled triggers false-positive "Illegal string offset") --- NEWS | 4 ++++ ext/opcache/Optimizer/compact_literals.c | 1 + ext/opcache/tests/bug76711.phpt | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 ext/opcache/tests/bug76711.phpt diff --git a/NEWS b/NEWS index a815840809..5fd64d6bd8 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,10 @@ PHP NEWS . Fixed bug #76901 (method_exists on SPL iterator passthrough method corrupts memory). (Nikita) +- Opcache: + . Fixed bug #76711 (OPcache enabled triggers false-positive "Illegal string + offset"). (Dmitry) + - Standard: . Fixed bug #75533 (array_reduce is slow when $carry is large array). (Manabu Matsui) diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index e10b9feab0..065962be73 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -378,6 +378,7 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx } else { map[i] = j; ZVAL_LONG(&zv, j); + Z_EXTRA(op_array->literals[i]) = 0; /* allow merging with FETCH_DIM_... */ zend_hash_index_add_new(&hash, Z_LVAL(op_array->literals[i]), &zv); if (i != j) { op_array->literals[j] = op_array->literals[i]; diff --git a/ext/opcache/tests/bug76711.phpt b/ext/opcache/tests/bug76711.phpt new file mode 100644 index 0000000000..781312503b --- /dev/null +++ b/ext/opcache/tests/bug76711.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #76711 OPcache enabled triggers false-positive "Illegal string offset" +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(0) +string(1) "s" -- 2.40.0