summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/opcache/Optimizer/dfa_pass.c14
-rw-r--r--ext/opcache/tests/bug75357.phpt44
3 files changed, 58 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 7d6db75536..35f52fc16c 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PHP NEWS
- Opcache:
. Fixed bug #75370 (Webserver hangs on valid PHP text). (Laruence)
+ . Fixed bug #75357 (segfault loading WordPress wp-admin). (Laruence)
- Openssl:
. Fixed bug #75363 (openssl_x509_parse leaks memory). (Bob)
diff --git a/ext/opcache/Optimizer/dfa_pass.c b/ext/opcache/Optimizer/dfa_pass.c
index ca4ca15e19..02f8410700 100644
--- a/ext/opcache/Optimizer/dfa_pass.c
+++ b/ext/opcache/Optimizer/dfa_pass.c
@@ -136,6 +136,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;
@@ -257,7 +270,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"
+ }
+}