diff --git a/agent/fw_drupal.c b/agent/fw_drupal.c index 3537f8b42..0312fef44 100644 --- a/agent/fw_drupal.c +++ b/agent/fw_drupal.c @@ -484,8 +484,7 @@ static void nr_drupal_wrap_hook_within_module_invoke_all( */ #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA - zval* curr_hook - = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks)); + zval* curr_hook = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks)); if (!nr_php_is_zval_non_empty_string(curr_hook)) { nrl_verbosedebug(NRL_FRAMEWORK, "%s: cannot extract hook name from global stack", diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 32976c64a..1ed5d2fcb 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -66,8 +66,7 @@ NR_PHP_WRAPPER(nr_drupal_exception) { if (NR_SUCCESS != nr_php_error_record_exception(NRPRG(txn), exception, priority, true, - NULL, - &NRPRG(exception_filters))) { + NULL, &NRPRG(exception_filters))) { nrl_verbosedebug(NRL_TXN, "Drupal: unable to record exception"); } @@ -134,12 +133,12 @@ static void nr_drupal8_add_method_callback(const zend_class_entry* ce, #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA static void nr_drupal8_add_method_callback_before_after_clean( - const zend_class_entry* ce, - const char* method, - size_t method_len, - nrspecialfn_t before_callback, - nrspecialfn_t after_callback, - nrspecialfn_t clean_callback) { + const zend_class_entry* ce, + const char* method, + size_t method_len, + nrspecialfn_t before_callback, + nrspecialfn_t after_callback, + nrspecialfn_t clean_callback) { zend_function* function = NULL; if (NULL == ce) { @@ -164,13 +163,13 @@ static void nr_drupal8_add_method_callback_before_after_clean( nr_php_class_entry_name(ce), NRSAFELEN(method_len), method); nr_php_wrap_user_function_before_after_clean( - class_method, nr_strlen(class_method), - before_callback, after_callback, clean_callback); + class_method, nr_strlen(class_method), before_callback, after_callback, + clean_callback); nr_free(class_method); } } -#endif // OAPI +#endif // OAPI /* * Purpose : Check if the given function or method is in the current call @@ -501,8 +500,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_callback) { #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA - zval* curr_hook - = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks)); + zval* curr_hook = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks)); if (UNEXPECTED(!nr_php_is_zval_non_empty_string(curr_hook))) { nrl_verbosedebug(NRL_FRAMEWORK, "%s: cannot extract hook name from global stack", @@ -515,7 +513,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_callback) { nr_drupal_hook_instrument(Z_STRVAL_P(module), Z_STRLEN_P(module), NRPRG(drupal_invoke_all_hook), NRPRG(drupal_invoke_all_hook_len) TSRMLS_CC); -#endif // OAPI +#endif // OAPI leave: NR_PHP_WRAPPER_CALL; @@ -536,7 +534,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) { || defined OVERWRITE_ZEND_EXECUTE_DATA char* prev_hook = NULL; int prev_hook_len; -#endif // not OAPI +#endif // not OAPI (void)wraprec; @@ -547,7 +545,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) { #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA nr_php_arg_release(&hook); -#endif // OAPI +#endif // OAPI goto leave; } @@ -561,7 +559,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) { = nr_strndup(Z_STRVAL_P(hook), Z_STRLEN_P(hook)); NRPRG(drupal_invoke_all_hook_len) = Z_STRLEN_P(hook); NRPRG(check_cufa) = true; -#endif // OAPI +#endif // OAPI callback = nr_php_arg_get(2, NR_EXECUTE_ORIG_ARGS TSRMLS_CC); /* This instrumentation will fail if callback has already been wrapped @@ -581,14 +579,14 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) { if (NULL == NRPRG(drupal_invoke_all_hook)) { NRPRG(check_cufa) = false; } -#endif // not OAPI +#endif // not OAPI -leave: ; +leave:; #if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO \ || defined OVERWRITE_ZEND_EXECUTE_DATA /* for OAPI, the _after callback handles this free */ nr_php_arg_release(&hook); -#endif // not OAPI +#endif // not OAPI } NR_PHP_WRAPPER_END @@ -605,7 +603,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) { nr_drupal_invoke_all_hook_stacks_pop(); } NR_PHP_WRAPPER_END -#endif // OAPI +#endif // OAPI /* * Purpose : Wrap the invoke() method of the module handler instance in use. @@ -642,10 +640,8 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) { #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA nr_drupal8_add_method_callback_before_after_clean( - ce, NR_PSTR("invokeallwith"), - nr_drupal94_invoke_all_with, - nr_drupal94_invoke_all_with_after, - nr_drupal94_invoke_all_with_clean); + ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with, + nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean); #else nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with TSRMLS_CC); @@ -766,14 +762,16 @@ void nr_drupal8_enable(TSRMLS_D) { */ #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA + // clang-format off nr_php_wrap_user_function_before_after_clean( - NR_PSTR("Symfony\\Component\\HttpKernel\\EventListe" - "ner\\RouterListener::onKernelRequest"), + NR_PSTR("Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"), nr_drupal8_name_the_wt_via_symfony, NULL, NULL); + // clang-format on #else - nr_php_wrap_user_function(NR_PSTR("Symfony\\Component\\HttpKernel\\EventListe" - "ner\\RouterListener::onKernelRequest"), + // clang-format off + nr_php_wrap_user_function(NR_PSTR("Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"), nr_drupal8_name_the_wt_via_symfony TSRMLS_CC); + // clang-format on #endif /* @@ -783,9 +781,10 @@ void nr_drupal8_enable(TSRMLS_D) { * above, but kicks in for use cases where the RouterListener is not * involved. */ - nr_php_wrap_user_function(NR_PSTR("Drupal\\Core\\Controller\\ControllerResolv" - "er::getControllerFromDefinition"), + // clang-format off + nr_php_wrap_user_function(NR_PSTR("Drupal\\Core\\Controller\\ControllerResolver::getControllerFromDefinition"), nr_drupal8_name_the_wt TSRMLS_CC); + // clang-format on /* * ExceptionSubscribers handle Drupal errors and exceptions before diff --git a/agent/fw_drupal_common.c b/agent/fw_drupal_common.c index 894ff2270..b0762239d 100644 --- a/agent/fw_drupal_common.c +++ b/agent/fw_drupal_common.c @@ -177,8 +177,9 @@ nr_status_t module_invoke_all_parse_module_and_hook_from_strings( nrl_verbosedebug(NRL_FRAMEWORK, "%s: module len is %d; ; " "hook='%.*s'; module_hook='%.*s'", - __func__, (int)module_len, NRSAFELEN(hook_len), NRSAFESTR(hook), - NRSAFELEN(module_hook_len), NRSAFESTR(module_hook)); + __func__, (int)module_len, NRSAFELEN(hook_len), + NRSAFESTR(hook), NRSAFELEN(module_hook_len), + NRSAFESTR(module_hook)); return NR_FAILURE; } diff --git a/agent/fw_drupal_common.h b/agent/fw_drupal_common.h index d94097a07..03f907031 100644 --- a/agent/fw_drupal_common.h +++ b/agent/fw_drupal_common.h @@ -147,23 +147,25 @@ nr_status_t module_invoke_all_parse_module_and_hook_from_strings( */ void nr_drupal_headers_add(zval* arg, bool is_drupal_7 TSRMLS_DC); - #if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \ && !defined OVERWRITE_ZEND_EXECUTE_DATA /* - * Purpose: Before an invoke_all style call, adds the hook to that hook states stacks + * Purpose: Before an invoke_all style call, adds the hook to that hook states + * stacks * - * Params : 1. A zval holding a copy of the hook invoked, to be managed by the hook - * states stacks and freed by nr_drupal_invoke_all_hook_stacks_pop() after the - * invoke_all call completes + * Params : 1. A zval holding a copy of the hook invoked, to be managed by the + * hook states stacks and freed by + * nr_drupal_invoke_all_hook_stacks_pop() after the invoke_all call + * completes */ void nr_drupal_invoke_all_hook_stacks_push(zval* hook_copy); /* - * Purpose: After an invoke_all style call, pops that states stack and conditionally - * pops the hook stack based on the previously popped state + * Purpose: After an invoke_all style call, pops that states stack and + * conditionally pops the hook stack based on the previously + * popped state */ void nr_drupal_invoke_all_hook_stacks_pop(); -#endif // OAPI +#endif // OAPI #endif /* FW_DRUPAL_COMMON_HDR */