@@ -129,15 +129,11 @@ NR_PHP_WRAPPER(nr_cakephp_name_the_wt_pre20) {
129
129
NR_PHP_WRAPPER_END
130
130
131
131
/*
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.
141
137
*
142
138
* txn naming scheme:
143
139
* In this case, `nr_txn_set_path` is called after `NR_PHP_WRAPPER_CALL` with
@@ -147,7 +143,7 @@ NR_PHP_WRAPPER_END
147
143
* default way of calling the wrapped function in func_end.
148
144
*
149
145
*/
150
- NR_PHP_WRAPPER (nr_cakephp_name_the_wt_2 ) {
146
+ NR_PHP_WRAPPER (nr_cakephp_name_the_wt_4 ) {
151
147
zval * this_var = 0 ;
152
148
zval * czval = 0 ;
153
149
char * controller = 0 ;
@@ -269,24 +265,21 @@ NR_PHP_WRAPPER(nr_cakephp_problem_1) {
269
265
NR_PHP_WRAPPER_END
270
266
271
267
/*
272
- * CakePHP 2 .0+
268
+ * CakePHP 4 .0+
273
269
*
274
270
* If the action or controller is not found during the dispatch process, the
275
271
* appropriate Exception will be created and thrown. We wrap the CakeException
276
272
* constructor instead of the Exception handler, since CakePHP allows for the
277
273
* handler to be completely replaced.
278
274
*
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
- *
282
275
* txn naming scheme:
283
276
* In this case, `nr_txn_set_path` is called before `NR_PHP_WRAPPER_CALL` with
284
277
* `NR_NOT_OK_TO_OVERWRITE` and as this corresponds to calling the wrapped
285
278
* function in func_begin it needs to be explicitly set as a before_callback to
286
279
* ensure OAPI compatibility. This entails that the first wrapped call gets to
287
280
* name the txn.
288
281
*/
289
- NR_PHP_WRAPPER (nr_cakephp_problem_2 ) {
282
+ NR_PHP_WRAPPER (nr_cakephp_problem_4 ) {
290
283
const char * name = "Exception" ;
291
284
292
285
(void )wraprec ;
@@ -312,20 +305,20 @@ void nr_cakephp_enable_1(TSRMLS_D) {
312
305
}
313
306
314
307
/*
315
- * Enable CakePHP 2 .0+
308
+ * Enable CakePHP 4 .0+
316
309
*/
317
- void nr_cakephp_enable_2 (TSRMLS_D ) {
310
+ void nr_cakephp_enable (TSRMLS_D ) {
318
311
nr_php_wrap_user_function (
319
312
NR_PSTR ("Cake\\Controller\\Controller::invokeAction" ),
320
313
nr_cakephp_name_the_wt_2 TSRMLS_CC );
321
314
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
322
315
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
323
316
nr_php_wrap_user_function_before_after_clean (
324
317
NR_PSTR ("Cake\\Core\\Exception\\CakeException::__construct" ),
325
- nr_cakephp_problem_2 , NULL , NULL );
318
+ nr_cakephp_problem_4 , NULL , NULL );
326
319
#else
327
320
nr_php_wrap_user_function (
328
321
NR_PSTR ("Cake\\Core\\Exception\\CakeException::__construct" ),
329
- nr_cakephp_problem_2 TSRMLS_CC );
322
+ nr_cakephp_problem_4 TSRMLS_CC );
330
323
#endif
331
324
}
0 commit comments