diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-09-20 12:33:46 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-09-20 12:33:46 +0300 |
commit | b8ffa3707c07e6edbe5db5a3fdf5516ba1f6bef0 (patch) | |
tree | 50737b90e5c7656f38f0c44f7d1c834c1791b2e8 | |
parent | f5729ec53224fd13e680825b0a71675be96fed53 (diff) | |
download | php-git-b8ffa3707c07e6edbe5db5a3fdf5516ba1f6bef0.tar.gz |
Fixed bug #76711 (OPcache enabled triggers false-positive "Illegal string offset")
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/opcache/Optimizer/compact_literals.c | 1 | ||||
-rw-r--r-- | ext/opcache/tests/bug76711.phpt | 19 |
3 files changed, 24 insertions, 0 deletions
@@ -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-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function test($foo) { + var_dump(0); + var_dump($foo[0]); +} +test("str"); +?> +--EXPECT-- +int(0) +string(1) "s" |