Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash with array_pop in php5.6 #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions extension/tests/xhprof_013.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
XHProf: Crash with array_pop
Author: cxfksword
--FILE--
<?php

xhprof_enable();
$arr = array('OK');
$ok = array_pop($arr);
echo "$ok\n";

?>
--EXPECTF--
OK
41 changes: 3 additions & 38 deletions extension/xhprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down