summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-09-20 12:34:31 +0300
committerDmitry Stogov <dmitry@zend.com>2018-09-20 12:34:31 +0300
commitc1b649d4488590235899f02489f85551d1bbe24b (patch)
treea7e8f6370700cb81fc5fca8ed4384828c8e10ab6 /ext/opcache
parentfe3ec212dc5a86b56a46f8ec58a9b8dc71ebddbd (diff)
parentb8ffa3707c07e6edbe5db5a3fdf5516ba1f6bef0 (diff)
downloadphp-git-c1b649d4488590235899f02489f85551d1bbe24b.tar.gz
Merge branch 'PHP-7.3'
* PHP-7.3: Fixed bug #76711 (OPcache enabled triggers false-positive "Illegal string offset")
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/Optimizer/compact_literals.c1
-rw-r--r--ext/opcache/tests/bug76711.phpt19
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index 60995568f6..f2cd7b4442 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -376,6 +376,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"