diff options
author | Xinchen Hui <laruence@gmail.com> | 2017-10-14 23:12:48 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2017-10-14 23:12:48 +0800 |
commit | dc6aaf0c8c4add323a8e804e887cfa85f1fc690c (patch) | |
tree | 38715d30f26a27a5d42044ef720cda27fd67e710 | |
parent | f26fc527da442943892f265ea48d94a22c29b2bc (diff) | |
parent | abbdbc21b0f285f86ccd3ba01074fd5e9de2a26f (diff) | |
download | php-git-dc6aaf0c8c4add323a8e804e887cfa85f1fc690c.tar.gz |
Merge branch 'PHP-7.2'
* PHP-7.2:
Fixed bug #75357 (segfault loading WordPress wp-admin)
-rw-r--r-- | ext/opcache/Optimizer/dfa_pass.c | 14 | ||||
-rw-r--r-- | ext/opcache/tests/bug75357.phpt | 44 |
2 files changed, 57 insertions, 1 deletions
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c index b62b35c8b6..733c99ce7a 100644 --- a/ext/opcache/Optimizer/dfa_pass.c +++ b/ext/opcache/Optimizer/dfa_pass.c @@ -140,6 +140,19 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa) shiftlist = (uint32_t *)do_alloca(sizeof(uint32_t) * op_array->last, use_heap); memset(shiftlist, 0, sizeof(uint32_t) * op_array->last); + /* remove empty callee_info */ + func_info = ZEND_FUNC_INFO(op_array); + if (func_info) { + zend_call_info **call_info = &func_info->callee_info; + while ((*call_info)) { + if ((*call_info)->caller_init_opline->opcode == ZEND_NOP) { + *call_info = (*call_info)->next_callee; + } else { + call_info = &(*call_info)->next_callee; + } + } + } + for (b = blocks; b < end; b++) { if (b->flags & (ZEND_BB_REACHABLE|ZEND_BB_UNREACHABLE_FREE)) { uint32_t end; @@ -261,7 +274,6 @@ static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa) } /* update call graph */ - func_info = ZEND_FUNC_INFO(op_array); if (func_info) { zend_call_info *call_info = func_info->callee_info; while (call_info) { diff --git a/ext/opcache/tests/bug75357.phpt b/ext/opcache/tests/bug75357.phpt new file mode 100644 index 0000000000..9dbace25e6 --- /dev/null +++ b/ext/opcache/tests/bug75357.phpt @@ -0,0 +1,44 @@ +--TEST-- +Bug #75357 (segfault loading WordPress wp-admin) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php + +function wp_slash( $value ) { + if ( is_array( $value ) ) { + foreach ( $value as $k => $v ) { + if ( is_array( $v ) ) { + $value[$k] = wp_slash( $v ); + } else { + $value[$k] = addslashes( $v ); + } + } + } else { + $value = addslashes( $value ); + } + + return $value; +} + +function addslashes_gpc($gpc) { + if ( get_magic_quotes_gpc() ) + $gpc = stripslashes($gpc); + + return wp_slash($gpc); +} + +var_dump(addslashes_gpc(array(array("test")))); +?> +--EXPECT-- +array(1) { + [0]=> + array(1) { + [0]=> + string(4) "test" + } +} |