Skip to content

Commit 5cc7987

Browse files
committed
chore(agent): update description and wrapper names
1 parent 0c5036f commit 5cc7987

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

agent/fw_cakephp.c

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,11 @@ NR_PHP_WRAPPER(nr_cakephp_name_the_wt_pre20) {
129129
NR_PHP_WRAPPER_END
130130

131131
/*
132-
* For CakePHP 2.0 and on, we do things a little differently as the params
133-
* array doesn't exist in the component any more. Instead we hook the
134-
* Controller's invokeAction method. This gets the request as a parameter
135-
* and we get the action from the params array in that object. The
136-
* controller object ($this) has a name, and that name is used (along
137-
* with the word "Controller" appended which is what the CakePHP code does).
138-
*
139-
* CakePHP 2.x is end-of-life and in maintenance mode (critical bugfixes only).
140-
* As such, functionality added in PHP 7.1+ is not well supported.
132+
* For CakePHP 4.0 and on, we retrieve the current controller object
133+
* and are able to extract the controller name from that. We then
134+
* retrieve the request object from the controller and are able to
135+
* extract the action name from that. We then concatenate the two
136+
* strings to form the transaction name.
141137
*
142138
* txn naming scheme:
143139
* In this case, `nr_txn_set_path` is called after `NR_PHP_WRAPPER_CALL` with
@@ -147,7 +143,7 @@ NR_PHP_WRAPPER_END
147143
* default way of calling the wrapped function in func_end.
148144
*
149145
*/
150-
NR_PHP_WRAPPER(nr_cakephp_name_the_wt_2) {
146+
NR_PHP_WRAPPER(nr_cakephp_name_the_wt_4) {
151147
zval* this_var = 0;
152148
zval* czval = 0;
153149
char* controller = 0;
@@ -269,24 +265,21 @@ NR_PHP_WRAPPER(nr_cakephp_problem_1) {
269265
NR_PHP_WRAPPER_END
270266

271267
/*
272-
* CakePHP 2.0+
268+
* CakePHP 4.0+
273269
*
274270
* If the action or controller is not found during the dispatch process, the
275271
* appropriate Exception will be created and thrown. We wrap the CakeException
276272
* constructor instead of the Exception handler, since CakePHP allows for the
277273
* handler to be completely replaced.
278274
*
279-
* CakePHP 2.x is end-of-life and in maintenance mode (critical bugfixes only).
280-
* As such, functionality added in PHP 7.1+ is not well supported.
281-
*
282275
* txn naming scheme:
283276
* In this case, `nr_txn_set_path` is called before `NR_PHP_WRAPPER_CALL` with
284277
* `NR_NOT_OK_TO_OVERWRITE` and as this corresponds to calling the wrapped
285278
* function in func_begin it needs to be explicitly set as a before_callback to
286279
* ensure OAPI compatibility. This entails that the first wrapped call gets to
287280
* name the txn.
288281
*/
289-
NR_PHP_WRAPPER(nr_cakephp_problem_2) {
282+
NR_PHP_WRAPPER(nr_cakephp_problem_4) {
290283
const char* name = "Exception";
291284

292285
(void)wraprec;
@@ -312,20 +305,20 @@ void nr_cakephp_enable_1(TSRMLS_D) {
312305
}
313306

314307
/*
315-
* Enable CakePHP 2.0+
308+
* Enable CakePHP 4.0+
316309
*/
317-
void nr_cakephp_enable_2(TSRMLS_D) {
310+
void nr_cakephp_enable(TSRMLS_D) {
318311
nr_php_wrap_user_function(
319312
NR_PSTR("Cake\\Controller\\Controller::invokeAction"),
320313
nr_cakephp_name_the_wt_2 TSRMLS_CC);
321314
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
322315
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
323316
nr_php_wrap_user_function_before_after_clean(
324317
NR_PSTR("Cake\\Core\\Exception\\CakeException::__construct"),
325-
nr_cakephp_problem_2, NULL, NULL);
318+
nr_cakephp_problem_4, NULL, NULL);
326319
#else
327320
nr_php_wrap_user_function(
328321
NR_PSTR("Cake\\Core\\Exception\\CakeException::__construct"),
329-
nr_cakephp_problem_2 TSRMLS_CC);
322+
nr_cakephp_problem_4 TSRMLS_CC);
330323
#endif
331324
}

agent/fw_hooks.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
*/
1313
#include "php_execute.h"
1414

15-
extern void nr_cakephp_enable_1(TSRMLS_D);
16-
extern void nr_cakephp_enable_2(TSRMLS_D);
15+
extern void nr_cakephp_enable(TSRMLS_D);
1716
extern nr_framework_classification_t nr_cakephp_special_1(
1817
const char* filename TSRMLS_DC);
1918
extern nr_framework_classification_t nr_cakephp_special_2(

agent/php_execute.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ typedef struct _nr_framework_table_t {
332332
// clang-format: off
333333
static const nr_framework_table_t all_frameworks[] = {
334334
{"CakePHP", "cakephp", NR_PSTR("cakephp/src/core/functions.php"), 0,
335-
nr_cakephp_enable_2, NR_FW_CAKEPHP},
335+
nr_cakephp_enable, NR_FW_CAKEPHP},
336336

337337
/*
338338
* Watch out: frameworks or CMS' build on top of CodeIgniter might not get
@@ -515,8 +515,6 @@ static nr_library_table_t libraries[] = {
515515
* with other frameworks or even without a framework at all.
516516
*/
517517
{"Laminas_Http", NR_PSTR("laminas-http/src/client.php"), nr_laminas_http_enable},
518-
519-
{"CakePHP3", NR_PSTR("cakephp/src/core/functions.php"), NULL},
520518
};
521519
// clang-format: on
522520

0 commit comments

Comments
 (0)