Skip to content

Commit 6be44b9

Browse files
committed
ensure runtime cache for function is initialized
When function is wrapped before its first use, its runtime cache is not yet initialized - it gets initialized on first function execution. However, the agent sometimes wraps functions before their execution. This type of use case requires the agent to initialize function's runtime cache.
1 parent 82477ae commit 6be44b9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

agent/php_user_instrument.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static inline void nr_php_wraprec_lookup_set(nruserfn_t* wr,
124124
// initialized only on the first call made to the function in that request. This would
125125
// mean that run_time_cache is NULL and wraprec cannot be stored yet! It will be stored
126126
// on the first call to the function when observer is registered for that function.
127+
zend_init_func_run_time_cache(&zf->op_array);
127128
if (NULL != RUN_TIME_CACHE(&zf->op_array)) {
128129
ZEND_OP_ARRAY_EXTENSION(&zf->op_array, NR_PHP_PROCESS_GLOBALS(op_array_extension_handle)) = wr;
129130
}

0 commit comments

Comments
 (0)