File tree Expand file tree Collapse file tree 7 files changed +36
-1
lines changed Expand file tree Collapse file tree 7 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -608,12 +608,16 @@ NR_PHP_WRAPPER(nr_drupal_wrap_module_invoke_all) {
608
608
NRPRG (drupal_module_invoke_all_hook )
609
609
= nr_strndup (Z_STRVAL_P (hook ), Z_STRLEN_P (hook ));
610
610
NRPRG (drupal_module_invoke_all_hook_len ) = Z_STRLEN_P (hook );
611
+ NRPRG (check_cufa ) = true;
611
612
612
613
NR_PHP_WRAPPER_CALL ;
613
614
614
615
nr_free (NRPRG (drupal_module_invoke_all_hook ));
615
616
NRPRG (drupal_module_invoke_all_hook ) = prev_hook ;
616
617
NRPRG (drupal_module_invoke_all_hook_len ) = prev_hook_len ;
618
+ if (NULL == NRPRG (drupal_module_invoke_all_hook )) {
619
+ NRPRG (check_cufa ) = false;
620
+ }
617
621
618
622
leave :
619
623
nr_php_arg_release (& hook );
Original file line number Diff line number Diff line change @@ -418,7 +418,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
418
418
NRPRG (drupal_module_invoke_all_hook )
419
419
= nr_strndup (Z_STRVAL_P (hook ), Z_STRLEN_P (hook ));
420
420
NRPRG (drupal_module_invoke_all_hook_len ) = Z_STRLEN_P (hook );
421
-
421
+ NRPRG ( check_cufa ) = true;
422
422
callback = nr_php_arg_get (2 , NR_EXECUTE_ORIG_ARGS TSRMLS_CC );
423
423
/* This instrumentation will fail if callback has already been wrapped
424
424
* with a special instrumentation callback in a different context.
@@ -432,6 +432,9 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
432
432
nr_free (NRPRG (drupal_module_invoke_all_hook ));
433
433
NRPRG (drupal_module_invoke_all_hook ) = prev_hook ;
434
434
NRPRG (drupal_module_invoke_all_hook_len ) = prev_hook_len ;
435
+ if (NULL == NRPRG (drupal_module_invoke_all_hook )) {
436
+ NRPRG (check_cufa ) = false;
437
+ }
435
438
436
439
leave :
437
440
nr_php_arg_release (& hook );
Original file line number Diff line number Diff line change @@ -494,10 +494,16 @@ NR_PHP_WRAPPER(nr_wordpress_exec_handle_tag) {
494
494
*/
495
495
char * old_tag = NRPRG (wordpress_tag );
496
496
497
+ NRPRG (check_cufa ) = true;
498
+
497
499
NRPRG (wordpress_tag ) = nr_wordpress_clean_tag (tag );
498
500
NR_PHP_WRAPPER_CALL ;
499
501
NRPRG (wordpress_tag ) = old_tag ;
502
+ if (NULL == NRPRG (wordpress_tag )) {
503
+ NRPRG (check_cufa ) = false;
504
+ }
500
505
} else {
506
+ NRPRG (check_cufa ) = false;
501
507
NR_PHP_WRAPPER_CALL ;
502
508
}
503
509
@@ -575,10 +581,17 @@ NR_PHP_WRAPPER(nr_wordpress_apply_filters) {
575
581
*/
576
582
char * old_tag = NRPRG (wordpress_tag );
577
583
584
+ NRPRG (check_cufa ) = true;
585
+
578
586
NRPRG (wordpress_tag ) = nr_wordpress_clean_tag (tag );
587
+
579
588
NR_PHP_WRAPPER_CALL ;
580
589
NRPRG (wordpress_tag ) = old_tag ;
590
+ if (NULL == NRPRG (wordpress_tag )) {
591
+ NRPRG (check_cufa ) = false;
592
+ }
581
593
} else {
594
+ NRPRG (check_cufa ) = false;
582
595
NR_PHP_WRAPPER_CALL ;
583
596
}
584
597
Original file line number Diff line number Diff line change @@ -378,6 +378,9 @@ int symfony1_in_dispatch; /* Whether we are currently within a
378
378
int symfony1_in_error404 ; /* Whether we are currently within a
379
379
sfError404Exception::printStackTrace() frame */
380
380
381
+ bool check_cufa ; /* Whether we need to check cufa because we are
382
+ instrumenting hooks, or whether we can skip cufa */
383
+
381
384
char * wordpress_tag ; /* The current WordPress tag */
382
385
nr_regex_t * wordpress_plugin_regex ; /* Regex for plugin filenames */
383
386
nr_regex_t * wordpress_theme_regex ; /* Regex for theme filenames */
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ PHP_RINIT_FUNCTION(newrelic) {
89
89
nr_php_extension_instrument_rescan (NRPRG (extensions ) TSRMLS_CC );
90
90
}
91
91
92
+ NRPRG (check_cufa ) = false;
93
+
92
94
NRPRG (mysql_last_conn ) = NULL ;
93
95
NRPRG (pgsql_last_conn ) = NULL ;
94
96
NRPRG (datastore_connections ) = nr_hashmap_create (
Original file line number Diff line number Diff line change @@ -108,6 +108,14 @@ static int nr_php_handle_cufa_fcall(zend_execute_data* execute_data) {
108
108
goto call_previous_and_return ;
109
109
}
110
110
111
+ /*
112
+ * If we don't have instrumented hooks that require this, skip to the
113
+ * end.
114
+ */
115
+ if (false == NRPRG (check_cufa )) {
116
+ goto call_previous_and_return ;
117
+ }
118
+
111
119
/*
112
120
* Since we're in the middle of a function call, the Zend Engine is actually
113
121
* only partway through constructing the new function frame. As a result, it
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ static void test_cufa_direct(TSRMLS_D) {
49
49
50
50
tlib_php_request_start ();
51
51
52
+ NRPRG (check_cufa ) = true;
52
53
define_cufa_function_f (TSRMLS_C );
53
54
tlib_php_request_eval (
54
55
"function g() { return call_user_func_array('f', array()); }" TSRMLS_CC );
@@ -74,6 +75,7 @@ static void test_cufa_indirect(TSRMLS_D) {
74
75
75
76
tlib_php_request_start ();
76
77
78
+ NRPRG (check_cufa ) = true;
77
79
define_cufa_function_f (TSRMLS_C );
78
80
tlib_php_request_eval (
79
81
"function g() { $cufa = 'call_user_func_array'; return $cufa('f', "
You can’t perform that action at this time.
0 commit comments