Skip to content

Commit a68bd59

Browse files
committed
review: improve conditional
1 parent 3c68c3d commit a68bd59

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

agent/fw_drupal8.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) {
706706
NR_PHP_WRAPPER(nr_drupal8_module_handler) {
707707
zend_class_entry* ce = NULL;
708708
zval** retval_ptr = NR_GET_RETURN_VALUE_PTR;
709-
bool hook_attribute_instrumentation = false;
710709

711710
NR_UNUSED_SPECIALFN;
712711
(void)wraprec;
@@ -728,26 +727,23 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) {
728727

729728
ce = Z_OBJCE_P(*retval_ptr);
730729

731-
hook_attribute_instrumentation
732-
= nr_drupal_hook_attribute_instrument(*retval_ptr);
733-
734-
if (!hook_attribute_instrumentation) {
735-
nr_drupal8_add_method_callback(
736-
ce, NR_PSTR("getimplementations"),
737-
nr_drupal8_post_get_implementations TSRMLS_CC);
738-
nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"),
739-
nr_drupal8_post_implements_hook TSRMLS_CC);
740-
/* Drupal 9.4 introduced a replacement method for getImplentations */
730+
if (nr_drupal_hook_attribute_instrument(*retval_ptr)) {
731+
NR_PHP_WRAPPER_LEAVE;
732+
}
733+
nr_drupal8_add_method_callback(ce, NR_PSTR("getimplementations"),
734+
nr_drupal8_post_get_implementations TSRMLS_CC);
735+
nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"),
736+
nr_drupal8_post_implements_hook TSRMLS_CC);
737+
/* Drupal 9.4 introduced a replacement method for getImplentations */
741738
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
742739
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
743-
nr_drupal8_add_method_callback_before_after_clean(
744-
ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with,
745-
nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean);
740+
nr_drupal8_add_method_callback_before_after_clean(
741+
ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with,
742+
nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean);
746743
#else
747-
nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"),
748-
nr_drupal94_invoke_all_with TSRMLS_CC);
744+
nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"),
745+
nr_drupal94_invoke_all_with TSRMLS_CC);
749746
#endif
750-
}
751747
}
752748
NR_PHP_WRAPPER_END
753749

0 commit comments

Comments
 (0)