Skip to content

Commit

Permalink
Improve logic. Make it compile again on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
NewEraCracker committed Oct 14, 2016
1 parent c9f22be commit 06c1958
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
43 changes: 21 additions & 22 deletions execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,30 +1647,14 @@ internal_function_handler ihandlers[] = {

static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
{
zval *return_value;
zval **return_value_ptr;
zval *this_ptr;
int ht;

if (fci) {
return_value = *fci->retval_ptr_ptr;
return_value_ptr = fci->retval_ptr_ptr;
this_ptr = fci->object_ptr;
ht = fci->param_count;
} else {
temp_variable *ret = &EX_T(execute_data_ptr->opline->result.var);
zend_function *fbc = execute_data_ptr->function_state.function;
return_value = ret->var.ptr;
return_value_ptr = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL;
this_ptr = execute_data_ptr->object;
ht = execute_data_ptr->opline->extended_value;
}
#else
static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
{
zval *return_value;
int ht = execute_data_ptr->opline->extended_value;
#endif
zval *return_value;
int ht;
char *lcname;
int function_name_strlen, free_lcname = 0;
zend_class_entry *ce = NULL;
Expand All @@ -1693,10 +1677,6 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re
zend_str_tolower(lcname, function_name_strlen);
}

#if PHP_VERSION_ID < 50500
return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr;
#endif

SDEBUG("function: %s", lcname);

if (SUHOSIN_G(in_code_type) == SUHOSIN_EVAL) {
Expand Down Expand Up @@ -1747,6 +1727,25 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re
int retval = 0;
void *handler = ((zend_internal_function *) execute_data_ptr->function_state.function)->handler;

#if PHP_VERSION_ID < 50500
return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr;
ht = execute_data_ptr->opline->extended_value;
#else
if (fci) {
return_value = *fci->retval_ptr_ptr;
return_value_ptr = fci->retval_ptr_ptr;
this_ptr = fci->object_ptr;
ht = fci->param_count;
} else {
temp_variable *ret = &EX_T(execute_data_ptr->opline->result.var);
zend_function *fbc = execute_data_ptr->function_state.function;
return_value = ret->var.ptr;
return_value_ptr = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL;
this_ptr = execute_data_ptr->object;
ht = execute_data_ptr->opline->extended_value;
}
#endif

if (handler != ZEND_FN(display_disabled_function)) {
retval = ih->handler(IH_HANDLER_PARAM_PASSTHRU);
}
Expand Down
4 changes: 4 additions & 0 deletions rfc1867_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#include "ext/standard/php_string.h"
#include "ext/standard/php_smart_str.h"

#ifdef PHP_WIN32
#include <win32/php_stdint.h>
#endif

#if defined(PHP_WIN32) && !defined(HAVE_ATOLL)
# define atoll(s) _atoi64(s)
# define HAVE_ATOLL 1
Expand Down

0 comments on commit 06c1958

Please sign in to comment.