From 2a7da47ce90d5294b8c0ee6139f15f70dbc2c613 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Tue, 25 Feb 2025 12:02:32 -0600 Subject: [PATCH 01/16] feat(agent): add drupal hook attribute instrumentation --- agent/fw_drupal8.c | 137 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 127 insertions(+), 10 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 1ed5d2fcb..c1c0eb6d9 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -605,12 +605,123 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) { NR_PHP_WRAPPER_END #endif // OAPI +/* + * Purpose: Instrument Drupal Attribute Hooks for Drupal 11.1+ + * + * Params: 1. A zval pointer to the moduleHandler instance in use by Drupal. + * + * Return: bool + * + */ +static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { + zval* hook_implementation_map = NULL; + + nr_php_string_hash_key_t* hook_key = NULL; + zval* hook_val = NULL; + nr_php_string_hash_key_t* class_key = NULL; + zval* class_val = NULL; + nr_php_string_hash_key_t* method_key = NULL; + zval* module_val = NULL; + zend_ulong key_num = 0; + + char* hook_str = NULL; + char* class_str = NULL; + char* method_str = NULL; + char* module_str = NULL; + char* hookpath = NULL; + + hook_implementation_map = nr_php_get_zval_object_property( + module_handler, "hookImplementationsMap"); + if (hook_implementation_map) { + if (nr_php_is_zval_valid_array(hook_implementation_map)) { + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), key_num, + hook_key, hook_val) { + (void)key_num; + if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[hook = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(hook_key))); + return false; + } + + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(hook_val), key_num, class_key, + class_val) { + (void)key_num; + if ((NULL == class_key) + || (0 == nr_php_is_zval_valid_array(class_val))) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[class = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(class_key))); + return false; + } + + ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(class_val), key_num, method_key, + module_val) { + (void)key_num; + + nr_free(hook_str); + nr_free(class_str); + nr_free(method_str); + nr_free(module_str); + nr_free(hookpath); + + if ((NULL == method_key) + || (0 == nr_php_is_zval_valid_string(module_val))) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[method = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(method_key))); + return false; + } + + hook_str = nr_strdup(ZEND_STRING_VALUE(hook_key)); + class_str = nr_strdup(ZEND_STRING_VALUE(class_key)); + method_str = nr_strdup(ZEND_STRING_VALUE(method_key)); + module_str = nr_strdup(Z_STRVAL_P(module_val)); + + if (0 + == nr_stricmp(ZEND_STRING_VALUE(class_key), + "Drupal\\Core\\Extension\\ProceduralCall")) { + hookpath = nr_formatf("%s", method_str); + } else { + hookpath = nr_formatf("%s::%s", class_str, method_str); + } + + nr_php_wrap_user_function_drupal(hookpath, nr_strlen(hookpath), + module_str, nr_strlen(module_str), + hook_str, nr_strlen(hook_str)); + } + ZEND_HASH_FOREACH_END(); + } + ZEND_HASH_FOREACH_END(); + } + ZEND_HASH_FOREACH_END(); + + } else { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap property not a valid array"); + return false; + } + } else { + nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); + return false; + } + + nr_free(hook_str); + nr_free(class_str); + nr_free(method_str); + nr_free(module_str); + nr_free(hookpath); + + return true; +} + /* * Purpose : Wrap the invoke() method of the module handler instance in use. */ NR_PHP_WRAPPER(nr_drupal8_module_handler) { zend_class_entry* ce = NULL; zval** retval_ptr = NR_GET_RETURN_VALUE_PTR; + bool hook_attribute_instrumentation = false; NR_UNUSED_SPECIALFN; (void)wraprec; @@ -632,20 +743,26 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) { ce = Z_OBJCE_P(*retval_ptr); - nr_drupal8_add_method_callback(ce, NR_PSTR("getimplementations"), - nr_drupal8_post_get_implementations TSRMLS_CC); - nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"), - nr_drupal8_post_implements_hook TSRMLS_CC); - /* Drupal 9.4 introduced a replacement method for getImplentations */ + hook_attribute_instrumentation + = nr_drupal_hook_attribute_instrument(*retval_ptr); + + if (!hook_attribute_instrumentation) { + nr_drupal8_add_method_callback( + ce, NR_PSTR("getimplementations"), + nr_drupal8_post_get_implementations TSRMLS_CC); + nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"), + nr_drupal8_post_implements_hook TSRMLS_CC); + /* Drupal 9.4 introduced a replacement method for getImplentations */ #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); + 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); #else - nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"), - nr_drupal94_invoke_all_with TSRMLS_CC); + nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"), + nr_drupal94_invoke_all_with TSRMLS_CC); #endif + } } NR_PHP_WRAPPER_END From 9500752598f48609bdb6a2e21f22fbe29c0592de Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Tue, 25 Feb 2025 12:15:45 -0600 Subject: [PATCH 02/16] fix: clean up mem freeing --- agent/fw_drupal8.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index c1c0eb6d9..4e0304915 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -605,6 +605,13 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) { NR_PHP_WRAPPER_END #endif // OAPI +#define NR_FREE_HOOK_MEM \ + nr_free(hook_str); \ + nr_free(class_str); \ + nr_free(method_str); \ + nr_free(module_str); \ + nr_free(hookpath); + /* * Purpose: Instrument Drupal Attribute Hooks for Drupal 11.1+ * @@ -641,6 +648,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(hook_key))); + NR_FREE_HOOK_MEM return false; } @@ -652,6 +660,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[class = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(class_key))); + NR_FREE_HOOK_MEM return false; } @@ -659,17 +668,14 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { module_val) { (void)key_num; - nr_free(hook_str); - nr_free(class_str); - nr_free(method_str); - nr_free(module_str); - nr_free(hookpath); + NR_FREE_HOOK_MEM if ((NULL == method_key) || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[method = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(method_key))); + NR_FREE_HOOK_MEM return false; } @@ -699,19 +705,16 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { } else { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap property not a valid array"); + NR_FREE_HOOK_MEM return false; } } else { nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); + NR_FREE_HOOK_MEM return false; } - nr_free(hook_str); - nr_free(class_str); - nr_free(method_str); - nr_free(module_str); - nr_free(hookpath); - + NR_FREE_HOOK_MEM return true; } From efc0c4e4706607079207204c57af1e0a10483dbc Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Tue, 25 Feb 2025 12:44:11 -0600 Subject: [PATCH 03/16] undef helper macro --- agent/fw_drupal8.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 4e0304915..cb9d40260 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -718,6 +718,8 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { return true; } +#undef NR_FREE_HOOK_MEM + /* * Purpose : Wrap the invoke() method of the module handler instance in use. */ From 3ded06d732c7cd7b4ee87b62f4d57a3dbbc60ef8 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 10:09:54 -0600 Subject: [PATCH 04/16] review: reduce memory allocation --- agent/fw_drupal8.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index cb9d40260..d2e774a70 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -605,13 +605,6 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) { NR_PHP_WRAPPER_END #endif // OAPI -#define NR_FREE_HOOK_MEM \ - nr_free(hook_str); \ - nr_free(class_str); \ - nr_free(method_str); \ - nr_free(module_str); \ - nr_free(hookpath); - /* * Purpose: Instrument Drupal Attribute Hooks for Drupal 11.1+ * @@ -631,10 +624,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { zval* module_val = NULL; zend_ulong key_num = 0; - char* hook_str = NULL; - char* class_str = NULL; - char* method_str = NULL; - char* module_str = NULL; char* hookpath = NULL; hook_implementation_map = nr_php_get_zval_object_property( @@ -648,7 +637,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(hook_key))); - NR_FREE_HOOK_MEM + nr_free(hookpath); return false; } @@ -660,7 +649,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[class = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(class_key))); - NR_FREE_HOOK_MEM + nr_free(hookpath); return false; } @@ -668,33 +657,30 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { module_val) { (void)key_num; - NR_FREE_HOOK_MEM - if ((NULL == method_key) || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[method = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(method_key))); - NR_FREE_HOOK_MEM + nr_free(hookpath); return false; } - hook_str = nr_strdup(ZEND_STRING_VALUE(hook_key)); - class_str = nr_strdup(ZEND_STRING_VALUE(class_key)); - method_str = nr_strdup(ZEND_STRING_VALUE(method_key)); - module_str = nr_strdup(Z_STRVAL_P(module_val)); - if (0 == nr_stricmp(ZEND_STRING_VALUE(class_key), "Drupal\\Core\\Extension\\ProceduralCall")) { - hookpath = nr_formatf("%s", method_str); + hookpath = nr_formatf("%s", ZEND_STRING_VALUE(method_key)); } else { - hookpath = nr_formatf("%s::%s", class_str, method_str); + hookpath = nr_formatf("%s::%s", ZEND_STRING_VALUE(class_key), + ZEND_STRING_VALUE(method_key)); } - nr_php_wrap_user_function_drupal(hookpath, nr_strlen(hookpath), - module_str, nr_strlen(module_str), - hook_str, nr_strlen(hook_str)); + nr_php_wrap_user_function_drupal( + hookpath, nr_strlen(hookpath), Z_STRVAL_P(module_val), + Z_STRLEN_P(module_val), ZEND_STRING_VALUE(hook_key), + ZEND_STRING_LEN(hook_key)); + + nr_free(hookpath); } ZEND_HASH_FOREACH_END(); } @@ -705,16 +691,13 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { } else { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap property not a valid array"); - NR_FREE_HOOK_MEM return false; } } else { nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); - NR_FREE_HOOK_MEM return false; } - NR_FREE_HOOK_MEM return true; } From 3c68c3d7063bf0c0915a551b9c68d289cbb78732 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 10:52:41 -0600 Subject: [PATCH 05/16] review: remove frees --- agent/fw_drupal8.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index d2e774a70..8992da9e5 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -637,7 +637,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(hook_key))); - nr_free(hookpath); return false; } @@ -649,7 +648,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[class = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(class_key))); - nr_free(hookpath); return false; } @@ -662,7 +660,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[method = %s]: invalid value", NRSAFESTR(ZEND_STRING_VALUE(method_key))); - nr_free(hookpath); return false; } From a68bd59f4757076ea81e722c16b5cb020eb8fd4c Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 11:03:40 -0600 Subject: [PATCH 06/16] review: improve conditional --- agent/fw_drupal8.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 8992da9e5..2997f3d67 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -706,7 +706,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { NR_PHP_WRAPPER(nr_drupal8_module_handler) { zend_class_entry* ce = NULL; zval** retval_ptr = NR_GET_RETURN_VALUE_PTR; - bool hook_attribute_instrumentation = false; NR_UNUSED_SPECIALFN; (void)wraprec; @@ -728,26 +727,23 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) { ce = Z_OBJCE_P(*retval_ptr); - hook_attribute_instrumentation - = nr_drupal_hook_attribute_instrument(*retval_ptr); - - if (!hook_attribute_instrumentation) { - nr_drupal8_add_method_callback( - ce, NR_PSTR("getimplementations"), - nr_drupal8_post_get_implementations TSRMLS_CC); - nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"), - nr_drupal8_post_implements_hook TSRMLS_CC); - /* Drupal 9.4 introduced a replacement method for getImplentations */ + if (nr_drupal_hook_attribute_instrument(*retval_ptr)) { + NR_PHP_WRAPPER_LEAVE; + } + nr_drupal8_add_method_callback(ce, NR_PSTR("getimplementations"), + nr_drupal8_post_get_implementations TSRMLS_CC); + nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"), + nr_drupal8_post_implements_hook TSRMLS_CC); + /* Drupal 9.4 introduced a replacement method for getImplentations */ #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); + 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); #else - nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"), - nr_drupal94_invoke_all_with TSRMLS_CC); + nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"), + nr_drupal94_invoke_all_with TSRMLS_CC); #endif - } } NR_PHP_WRAPPER_END From 6b3d5b1536f40234b2de87bca522ed11a4637118 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 11:14:07 -0600 Subject: [PATCH 07/16] review: use STR_KEY_VAL zend loop --- agent/fw_drupal8.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 2997f3d67..bcbe1c149 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -622,7 +622,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { zval* class_val = NULL; nr_php_string_hash_key_t* method_key = NULL; zval* module_val = NULL; - zend_ulong key_num = 0; char* hookpath = NULL; @@ -630,9 +629,8 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { module_handler, "hookImplementationsMap"); if (hook_implementation_map) { if (nr_php_is_zval_valid_array(hook_implementation_map)) { - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), key_num, - hook_key, hook_val) { - (void)key_num; + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), + hook_key, hook_val) { if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook = %s]: invalid value", @@ -640,9 +638,8 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { return false; } - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(hook_val), key_num, class_key, - class_val) { - (void)key_num; + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, + class_val) { if ((NULL == class_key) || (0 == nr_php_is_zval_valid_array(class_val))) { nrl_warning(NRL_FRAMEWORK, @@ -651,10 +648,8 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { return false; } - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(class_val), key_num, method_key, - module_val) { - (void)key_num; - + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key, + module_val) { if ((NULL == method_key) || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, From c81102098c152ec0bf2aeebe32d8e052af3eb2aa Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 11:28:08 -0600 Subject: [PATCH 08/16] cleanup: remove undef --- agent/fw_drupal8.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index bcbe1c149..150df1978 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -693,8 +693,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { return true; } -#undef NR_FREE_HOOK_MEM - /* * Purpose : Wrap the invoke() method of the module handler instance in use. */ From 42d5af5211cb76d57b49d057caf1cd6fc00b4546 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 13:52:26 -0600 Subject: [PATCH 09/16] review: flatten conditional --- agent/fw_drupal8.c | 104 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 150df1978..4e534ad77 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -627,68 +627,66 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { hook_implementation_map = nr_php_get_zval_object_property( module_handler, "hookImplementationsMap"); - if (hook_implementation_map) { - if (nr_php_is_zval_valid_array(hook_implementation_map)) { - ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), - hook_key, hook_val) { - if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { + + if (NULL == hook_implementation_map) { + nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); + return false; + } + + if (!nr_php_is_zval_valid_array(hook_implementation_map)) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap property not a valid array"); + return false; + } + + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key, + hook_val) { + if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[hook = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(hook_key))); + return false; + } + + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) { + if ((NULL == class_key) || (0 == nr_php_is_zval_valid_array(class_val))) { + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[class = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(class_key))); + return false; + } + + ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key, + module_val) { + if ((NULL == method_key) + || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[hook = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(hook_key))); + "hookImplementationsMap[method = %s]: invalid value", + NRSAFESTR(ZEND_STRING_VALUE(method_key))); return false; } - ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, - class_val) { - if ((NULL == class_key) - || (0 == nr_php_is_zval_valid_array(class_val))) { - nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[class = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(class_key))); - return false; - } - - ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key, - module_val) { - if ((NULL == method_key) - || (0 == nr_php_is_zval_valid_string(module_val))) { - nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[method = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(method_key))); - return false; - } - - if (0 - == nr_stricmp(ZEND_STRING_VALUE(class_key), - "Drupal\\Core\\Extension\\ProceduralCall")) { - hookpath = nr_formatf("%s", ZEND_STRING_VALUE(method_key)); - } else { - hookpath = nr_formatf("%s::%s", ZEND_STRING_VALUE(class_key), - ZEND_STRING_VALUE(method_key)); - } - - nr_php_wrap_user_function_drupal( - hookpath, nr_strlen(hookpath), Z_STRVAL_P(module_val), - Z_STRLEN_P(module_val), ZEND_STRING_VALUE(hook_key), - ZEND_STRING_LEN(hook_key)); - - nr_free(hookpath); - } - ZEND_HASH_FOREACH_END(); + if (0 + == nr_stricmp(ZEND_STRING_VALUE(class_key), + "Drupal\\Core\\Extension\\ProceduralCall")) { + hookpath = nr_formatf("%s", ZEND_STRING_VALUE(method_key)); + } else { + hookpath = nr_formatf("%s::%s", ZEND_STRING_VALUE(class_key), + ZEND_STRING_VALUE(method_key)); } - ZEND_HASH_FOREACH_END(); + + nr_php_wrap_user_function_drupal( + hookpath, nr_strlen(hookpath), Z_STRVAL_P(module_val), + Z_STRLEN_P(module_val), ZEND_STRING_VALUE(hook_key), + ZEND_STRING_LEN(hook_key)); + + nr_free(hookpath); } ZEND_HASH_FOREACH_END(); - - } else { - nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap property not a valid array"); - return false; } - } else { - nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); - return false; + ZEND_HASH_FOREACH_END(); } + ZEND_HASH_FOREACH_END(); return true; } From d876e0e684483bae8ee442f7420476f0f4958d4a Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 16:37:51 -0600 Subject: [PATCH 10/16] fix warnings --- agent/fw_drupal8.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 4e534ad77..b2e4aa0ed 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -642,17 +642,14 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key, hook_val) { if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { - nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[hook = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(hook_key))); + nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook]: invalid value"); return false; } ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) { if ((NULL == class_key) || (0 == nr_php_is_zval_valid_array(class_val))) { nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[class = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(class_key))); + "hookImplementationsMap[class]: invalid value"); return false; } @@ -661,8 +658,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { if ((NULL == method_key) || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[method = %s]: invalid value", - NRSAFESTR(ZEND_STRING_VALUE(method_key))); + "hookImplementationsMap[method]: invalid value"); return false; } From ea0e4cfae60efa443919a75fd33a15d1aea8bc37 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Thu, 27 Feb 2025 16:41:53 -0600 Subject: [PATCH 11/16] clarify warning --- agent/fw_drupal8.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index b2e4aa0ed..481780a8f 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -642,14 +642,15 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key, hook_val) { if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { - nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook]: invalid value"); + nrl_warning(NRL_FRAMEWORK, + "hookImplementationsMap[hook]: invalid key or value"); return false; } ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) { if ((NULL == class_key) || (0 == nr_php_is_zval_valid_array(class_val))) { nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[class]: invalid value"); + "hookImplementationsMap[class]: invalid key or value"); return false; } @@ -658,7 +659,7 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { if ((NULL == method_key) || (0 == nr_php_is_zval_valid_string(module_val))) { nrl_warning(NRL_FRAMEWORK, - "hookImplementationsMap[method]: invalid value"); + "hookImplementationsMap[method]: invalid key or value"); return false; } From 2d515f1623b5ce74898dc2679b6ca4f0d16312af Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Fri, 28 Feb 2025 10:12:53 -0600 Subject: [PATCH 12/16] remove NULL check --- agent/fw_drupal8.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 481780a8f..878b14902 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -628,11 +628,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { hook_implementation_map = nr_php_get_zval_object_property( module_handler, "hookImplementationsMap"); - if (NULL == hook_implementation_map) { - nrl_warning(NRL_FRAMEWORK, "NULL hookImplementationsMap object property"); - return false; - } - if (!nr_php_is_zval_valid_array(hook_implementation_map)) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap property not a valid array"); From 5a902824771112b41a060f455ffd74847a10c608 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Fri, 28 Feb 2025 13:24:28 -0600 Subject: [PATCH 13/16] add integration tests --- .../mock_module_handler_invalid_key.php | 34 ++++++++++++++++++ .../mock_module_handler_invalid_map.php | 30 ++++++++++++++++ .../mock_module_handler_invalid_module.php | 34 ++++++++++++++++++ .../mock_module_handler_invalid_value.php | 34 ++++++++++++++++++ ...t_hook_implementations_map_invalid_key.php | 35 +++++++++++++++++++ ...t_hook_implementations_map_invalid_map.php | 35 +++++++++++++++++++ ...ook_implementations_map_invalid_module.php | 35 +++++++++++++++++++ ...hook_implementations_map_invalid_value.php | 35 +++++++++++++++++++ 8 files changed, 272 insertions(+) create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_invalid_key.php create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_invalid_map.php create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_invalid_module.php create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_invalid_value.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php diff --git a/tests/integration/frameworks/drupal/mock_module_handler_invalid_key.php b/tests/integration/frameworks/drupal/mock_module_handler_invalid_key.php new file mode 100644 index 000000000..faffb7ded --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_invalid_key.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 1 => array('classname_b' => array('methodname_b' => 'modulename_b')), + 'hookname_c' => array('classname_c', array('methodname_c', 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/mock_module_handler_invalid_map.php b/tests/integration/frameworks/drupal/mock_module_handler_invalid_map.php new file mode 100644 index 000000000..ac61d62bf --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_invalid_map.php @@ -0,0 +1,30 @@ +hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/mock_module_handler_invalid_module.php b/tests/integration/frameworks/drupal/mock_module_handler_invalid_module.php new file mode 100644 index 000000000..d6fa753aa --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_invalid_module.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 'hookname_b' => array('classname_b' => array('methodname_b' => array(1, 2, 3))), + 'hookname_c' => array('classname_c' => array('methodname_c' => 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/mock_module_handler_invalid_value.php b/tests/integration/frameworks/drupal/mock_module_handler_invalid_value.php new file mode 100644 index 000000000..cdec24a98 --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_invalid_value.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 'hookname_b' => array('classname_b' => 'just a string'), + 'hookname_c' => array('classname_c' => array('methodname_c' => 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php new file mode 100644 index 000000000..be9d5364a --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php @@ -0,0 +1,35 @@ +moduleHandler(); diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php new file mode 100644 index 000000000..65694b16f --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php @@ -0,0 +1,35 @@ +moduleHandler(); diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php new file mode 100644 index 000000000..91848ef3e --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php @@ -0,0 +1,35 @@ +moduleHandler(); diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php new file mode 100644 index 000000000..7cd3c4a72 --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php @@ -0,0 +1,35 @@ +moduleHandler(); From 0836487a42ccc5fae16f9d4e267f0651931965ec Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Mon, 3 Mar 2025 11:30:37 -0600 Subject: [PATCH 14/16] test: add valid drupal hookmap test --- .../drupal/mock_module_handler_valid.php | 34 ++++++++++++++++++ .../test_hook_implementations_map_valid.php | 35 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_valid.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php diff --git a/tests/integration/frameworks/drupal/mock_module_handler_valid.php b/tests/integration/frameworks/drupal/mock_module_handler_valid.php new file mode 100644 index 000000000..a17bb4d2b --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_valid.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 'hookname_b' => array('classname_b' => array('methodname_b' => 'modulename_b')), + 'hookname_c' => array('classname_c' => array('methodname_c' => 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php new file mode 100644 index 000000000..15424269a --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php @@ -0,0 +1,35 @@ +moduleHandler(); From f0579a556401ae3ef3dc045de2981e5e5b3c9f78 Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Mon, 3 Mar 2025 13:20:19 -0600 Subject: [PATCH 15/16] fix: check for 0 length array values and key strings --- agent/fw_drupal8.c | 18 +++++++--- .../mock_module_handler_empty_array.php | 34 ++++++++++++++++++ .../drupal/mock_module_handler_empty_key.php | 34 ++++++++++++++++++ ...t_hook_implementations_map_empty_array.php | 35 +++++++++++++++++++ ...est_hook_implementations_map_empty_key.php | 35 +++++++++++++++++++ 5 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_empty_array.php create mode 100644 tests/integration/frameworks/drupal/mock_module_handler_empty_key.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php create mode 100644 tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php diff --git a/agent/fw_drupal8.c b/agent/fw_drupal8.c index 878b14902..5b2e3031e 100644 --- a/agent/fw_drupal8.c +++ b/agent/fw_drupal8.c @@ -605,6 +605,16 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) { NR_PHP_WRAPPER_END #endif // OAPI +static bool nr_validate_key_val_arr(nr_php_string_hash_key_t* key, zval* val) { + if (NULL == key || 0 == ZEND_STRING_LEN(key) + || 0 == nr_php_is_zval_valid_array(val) + || 0 == zend_hash_num_elements(Z_ARRVAL_P(val))) { + return true; + } else { + return false; + } +} + /* * Purpose: Instrument Drupal Attribute Hooks for Drupal 11.1+ * @@ -636,14 +646,14 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_implementation_map), hook_key, hook_val) { - if ((NULL == hook_key) || (0 == nr_php_is_zval_valid_array(hook_val))) { + if (nr_validate_key_val_arr(hook_key, hook_val)) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[hook]: invalid key or value"); return false; } ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(hook_val), class_key, class_val) { - if ((NULL == class_key) || (0 == nr_php_is_zval_valid_array(class_val))) { + if (nr_validate_key_val_arr(class_key, class_val)) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[class]: invalid key or value"); return false; @@ -651,8 +661,8 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) { ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(class_val), method_key, module_val) { - if ((NULL == method_key) - || (0 == nr_php_is_zval_valid_string(module_val))) { + if (NULL == method_key + || 0 == nr_php_is_zval_valid_string(module_val)) { nrl_warning(NRL_FRAMEWORK, "hookImplementationsMap[method]: invalid key or value"); return false; diff --git a/tests/integration/frameworks/drupal/mock_module_handler_empty_array.php b/tests/integration/frameworks/drupal/mock_module_handler_empty_array.php new file mode 100644 index 000000000..0cf5db0a8 --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_empty_array.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 'hookname_b' => array(), + 'hookname_c' => array('classname_c' => array('methodname_c' => 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/mock_module_handler_empty_key.php b/tests/integration/frameworks/drupal/mock_module_handler_empty_key.php new file mode 100644 index 000000000..3f057711e --- /dev/null +++ b/tests/integration/frameworks/drupal/mock_module_handler_empty_key.php @@ -0,0 +1,34 @@ + array('classname' => array('methodname' => 'modulename')), + 'hookname_b' => array('' => array('methodname_b' => 'modulename_b')), + 'hookname_c' => array('classname_c' => array('methodname_c' => 'modulename_c')), + ); + + // to avoid editor warnings + public function invokeAllWith($hook_str, $callback) + { + return null; + } + + // for debugging purposes + public function dump() + { + var_dump($this->hookImplementationsMap); + } + } +} diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php new file mode 100644 index 000000000..64f2a2c90 --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php @@ -0,0 +1,35 @@ +moduleHandler(); diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php new file mode 100644 index 000000000..196d85da4 --- /dev/null +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php @@ -0,0 +1,35 @@ +moduleHandler(); From 2481b5be246166c69a9c80ac97899151ee9b39fb Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Mon, 3 Mar 2025 16:46:16 -0600 Subject: [PATCH 16/16] fix: skipif for 7.4+ --- .../drupal/test_hook_implementations_map_empty_array.php | 7 +++++++ .../drupal/test_hook_implementations_map_empty_key.php | 7 +++++++ .../drupal/test_hook_implementations_map_invalid_key.php | 7 +++++++ .../drupal/test_hook_implementations_map_invalid_map.php | 7 +++++++ .../test_hook_implementations_map_invalid_module.php | 7 +++++++ .../drupal/test_hook_implementations_map_invalid_value.php | 7 +++++++ .../drupal/test_hook_implementations_map_valid.php | 7 +++++++ 7 files changed, 49 insertions(+) diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php index 64f2a2c90..997dd7b0c 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_array.php @@ -8,6 +8,13 @@ Verify agent behavior when key value is an empty array */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php index 196d85da4..1ee7a2400 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_empty_key.php @@ -8,6 +8,13 @@ Verify agent behavior when key is an empty string */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php index be9d5364a..ac60f928f 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_key.php @@ -8,6 +8,13 @@ Verify agent does not crash when map key is not a string. */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php index 65694b16f..a55a2306b 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_map.php @@ -8,6 +8,13 @@ Verify the agent does not crash when handling an invalid hookImplementationsMap property. */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php index 91848ef3e..3a9b9c529 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_module.php @@ -8,6 +8,13 @@ Verify agent does not crash when module name is not a string. */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php index 7cd3c4a72..892bc533a 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_invalid_value.php @@ -8,6 +8,13 @@ Verify agent does not crash when key value is not an array. */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */ diff --git a/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php b/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php index 15424269a..afe54c69c 100644 --- a/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php +++ b/tests/integration/frameworks/drupal/test_hook_implementations_map_valid.php @@ -8,6 +8,13 @@ Verify agent behavior on valid hookImplementationsMap */ +/*SKIPIF += 7.4 required\n"); +} +*/ + /*INI newrelic.framework = drupal8 */