File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,9 @@ PHP_RINIT_FUNCTION(newrelic) {
63
63
NRPRG (drupal_http_request_depth ) = 0 ;
64
64
#endif
65
65
#else
66
+ NRPRG (pid ) = nr_getpid ();
66
67
NRPRG (user_function_wrappers ) = nr_vector_create (64 , NULL , NULL );
67
68
#endif
68
- NRPRG (pid ) = nr_getpid ();
69
69
70
70
if ((0 == NR_PHP_PROCESS_GLOBALS (enabled )) || (0 == NRINI (enabled ))) {
71
71
return SUCCESS ;
Original file line number Diff line number Diff line change @@ -164,7 +164,13 @@ static inline nruserfn_t* nr_php_wraprec_lookup_get(zend_function* zf) {
164
164
if (NULL != RUN_TIME_CACHE (& zf -> op_array )) {
165
165
wraprec = ZEND_OP_ARRAY_EXTENSION (& zf -> op_array , NR_PHP_PROCESS_GLOBALS (op_array_extension_handle ));
166
166
}
167
- if (NULL != wraprec && NRPRG (pid ) != wraprec -> pid ) {
167
+ if (NULL != wraprec && wraprec -> magic != NR_USERFN_T_MAGIC ) {
168
+ if (nrl_should_print (NRL_VERBOSEDEBUG , NRL_INSTRUMENT )) {
169
+ char * name = nr_php_function_debug_name (zf );
170
+ nrl_verbosedebug (NRL_INSTRUMENT , "%s - wraprec for {%s} is invalid" ,
171
+ __func__ , name );
172
+ nr_free (name );
173
+ }
168
174
wraprec = NULL ;
169
175
}
170
176
return wraprec ;
@@ -346,9 +352,7 @@ static void nr_php_wrap_user_function_internal(nruserfn_t* wraprec TSRMLS_DC) {
346
352
347
353
nruserfn_t * nr_php_user_wraprec_create (void ) {
348
354
nruserfn_t * wr = (nruserfn_t * )nr_zalloc (sizeof (nruserfn_t ));
349
- /* NRPRG(pid) is set in rinit but it's sometimes needed before rinit,
350
- * i.e. when wraprec is added via INI */
351
- wr -> pid = (0 != NRPRG (pid ) ? NRPRG (pid ) : nr_getpid ());
355
+ wr -> magic = NR_USERFN_T_MAGIC ;
352
356
return wr ;
353
357
}
354
358
Original file line number Diff line number Diff line change 14
14
#include "php_user_instrument_hashmap_key.h"
15
15
16
16
struct _nruserfn_t ;
17
+ #define NR_USERFN_T_MAGIC 0x6e72757372666e74ULL /* "nrusrfnt" */
17
18
18
19
/*
19
20
* This is an unused structure that is used to ensure that a bare return won't
@@ -35,6 +36,7 @@ typedef void (*nruserfn_declared_t)(TSRMLS_D);
35
36
* and so the strings must be discarded in nr_php_user_wraprec_destroy;
36
37
*/
37
38
typedef struct _nruserfn_t {
39
+ uint64_t magic ; /* memory marker */
38
40
struct _nruserfn_t * next ; /* singly linked list next pointer */
39
41
40
42
#if ZEND_MODULE_API_NO == ZEND_7_4_X_API_NO
@@ -108,7 +110,6 @@ typedef struct _nruserfn_t {
108
110
#if ZEND_MODULE_API_NO >= ZEND_7_4_X_API_NO
109
111
char * wordpress_plugin_theme ;
110
112
#endif
111
- int pid ; /* pid of a process that created this wraprec */
112
113
} nruserfn_t ;
113
114
114
115
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO
You can’t perform that action at this time.
0 commit comments