diff --git a/apm.c b/apm.c index 624369c..ec7ee86 100644 --- a/apm.c +++ b/apm.c @@ -94,7 +94,8 @@ static int apm_end_silence_opcode_handler(ZEND_USER_OPCODE_HANDLER_ARGS) return ZEND_USER_OPCODE_DISPATCH; } -int apm_write(const char *str, +#if PHP_VERSION_ID < 70100 +static int apm_write(const char *str, #if PHP_VERSION_ID >= 70000 size_t #else @@ -107,6 +108,7 @@ length) smart_str_0(APM_G(buffer)); return length; } +#endif void (*old_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args); @@ -596,8 +598,15 @@ void extract_data(TSRMLS_D) zend_is_auto_global_compat("_COOKIE"); if (FETCH_HTTP_GLOBALS(COOKIE)) { if (Z_ARRVAL_P(tmp)->nNumOfElements > 0) { +#if PHP_VERSION_ID >= 70100 + zend_string *tmpstr; + tmpstr = zend_print_zval_r_to_str(tmp, 0); + smart_str_append(&APM_RD(cookies), tmpstr); + zend_string_release(tmpstr); +#else APM_G(buffer) = &APM_RD(cookies); zend_print_zval_r_ex(apm_write, tmp, 0 TSRMLS_CC); +#endif APM_RD(cookies_found) = 1; } } @@ -606,8 +615,15 @@ void extract_data(TSRMLS_D) zend_is_auto_global_compat("_POST"); if (FETCH_HTTP_GLOBALS(POST)) { if (Z_ARRVAL_P(tmp)->nNumOfElements > 0) { +#if PHP_VERSION_ID >= 70100 + zend_string *tmpstr; + tmpstr = zend_print_zval_r_to_str(tmp, 0); + smart_str_append(&APM_RD(post_vars), tmpstr); + zend_string_release(tmpstr); +#else APM_G(buffer) = &APM_RD(post_vars); zend_print_zval_r_ex(apm_write, tmp, 0 TSRMLS_CC); +#endif APM_RD(post_vars_found) = 1; } } diff --git a/php_apm.h b/php_apm.h index 4a5ee24..3fe29e3 100644 --- a/php_apm.h +++ b/php_apm.h @@ -368,14 +368,6 @@ ZEND_END_MODULE_GLOBALS(apm) # define add_assoc_long_compat(array, key, value) add_assoc_long_ex((array), (key), (sizeof(key)), (value)); #endif -int apm_write(const char *str, -#if PHP_VERSION_ID >= 70000 -size_t -#else -uint -#endif -length); - +void extract_data(TSRMLS_D); #endif -void extract_data(TSRMLS_D);