From c79aa6269da9a9b26da636cedce151daf7a2459a Mon Sep 17 00:00:00 2001 From: cxfksword Date: Tue, 7 Jul 2015 18:07:44 +0800 Subject: [PATCH] Fix crash with array_pop in php5.6 See: #45 #63 --- extension/tests/xhprof_013.phpt | 14 +++++++++++ extension/xhprof.c | 41 +++------------------------------ 2 files changed, 17 insertions(+), 38 deletions(-) create mode 100644 extension/tests/xhprof_013.phpt diff --git a/extension/tests/xhprof_013.phpt b/extension/tests/xhprof_013.phpt new file mode 100644 index 00000000..851da7df --- /dev/null +++ b/extension/tests/xhprof_013.phpt @@ -0,0 +1,14 @@ +--TEST-- +XHProf: Crash with array_pop +Author: cxfksword +--FILE-- + +--EXPECTF-- +OK diff --git a/extension/xhprof.c b/extension/xhprof.c index 66aa041e..c1e13a64 100644 --- a/extension/xhprof.c +++ b/extension/xhprof.c @@ -1714,45 +1714,10 @@ ZEND_DLEXPORT void hp_execute_internal(zend_execute_data *execute_data, if (!_zend_execute_internal) { /* no old override to begin with. so invoke the builtin's implementation */ - -#if ZEND_EXTENSION_API_NO >= 220121212 - /* PHP 5.5. This is just inlining a copy of execute_internal(). */ - - if (fci != NULL) { - ((zend_internal_function *) execute_data->function_state.function)->handler( - fci->param_count, - *fci->retval_ptr_ptr, - fci->retval_ptr_ptr, - fci->object_ptr, - 1 TSRMLS_CC); - } else { - zval **return_value_ptr = &EX_TMP_VAR(execute_data, execute_data->opline->result.var)->var.ptr; - ((zend_internal_function *) execute_data->function_state.function)->handler( - execute_data->opline->extended_value, - *return_value_ptr, - (execute_data->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) - ? return_value_ptr - : NULL, - execute_data->object, - ret TSRMLS_CC); - } -#elif ZEND_EXTENSION_API_NO >= 220100525 - zend_op *opline = EX(opline); - temp_variable *retvar = &EX_T(opline->result.var); - ((zend_internal_function *) EX(function_state).function)->handler( - opline->extended_value, - retvar->var.ptr, - (EX(function_state).function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? - &retvar->var.ptr:NULL, - EX(object), ret TSRMLS_CC); +#if PHP_VERSION_ID < 50500 + execute_internal(execute_data, ret TSRMLS_CC); #else - zend_op *opline = EX(opline); - ((zend_internal_function *) EX(function_state).function)->handler( - opline->extended_value, - EX_T(opline->result.u.var).var.ptr, - EX(function_state).function->common.return_reference ? - &EX_T(opline->result.u.var).var.ptr:NULL, - EX(object), ret TSRMLS_CC); + execute_internal(execute_data, fci, ret TSRMLS_CC); #endif } else { /* call the old override */