brunitto/cakephp-new-relic

Undefined index: prefix

Closed this issue · 13 comments

I'm getting this error on a new setup.

Notice (8): Undefined index: prefix [ROOT/vendor/brunitto/cakephp-new-relic/src/Routing/Filter/NameTransactionFilter.php, line 51]

It's necessary to add the following line:

DispatcherFactory::add('NewRelic.NameTransaction');

after the Routing:

...
DispatcherFactory::add('Routing');
DispatcherFactory::add('NewRelic.NameTransaction');

I will add this in the README.

I will add this information in the README in the next release.

Hi,
I add
use Cake\Routing;
use Cake\Routing\DispatcherFactory;

and

DispatcherFactory::add('Routing');
DispatcherFactory::add('NewRelic.NameTransaction');
In boostrap.php
But i still having the notice

Notice (8): Undefined index: prefix [ROOT/vendor/brunitto/cakephp-new-relic/src/Routing/Filter/NameTransactionFilter.php, line 51]

Hi there @aloisejulian

I will try to reproduce this today, and release a correct version if necessary. Thanks for the help.

thanks @brunitto .
I will wait for your answer.

Hi there @aloisejulian

I was able to reproduce the error. It was necessary to raise the error reporting error in PHP to E_ALL, as the error is reported as E_NOTICE.

Debugging a little, I was able to find that the $request->params associative array given by the $event argument in the beforeDispatch() function within NameTransactionFilter class, always contains the plugin key, even when the app is not using plugins. This is not true for the prefix key, that is not included when not using prefixes. The code need properly null checking.

Marking this as a bug and adding to the next milestone (1.3.0).

I will try to release this version this week, please hold on.

Thanks.

@brunitto Ok. thanks for your help! I will wait for the new release.

@aloisejulian please confirm that the issue was solved, it was for me. Feel free to reopen if not.

@brunitto sorry for the delay... Its perfect now!
Thanks you!

dilab commented

This issue is still there in the Middleware

Notice (8): Undefined index: prefix in [/.../vendor/brunitto/cakephp-new-relic/src/Middleware/NameTransactionMiddleware.php, line

Reopening the issue... I will try to reproduce today and release a new version if necessary,

dilab commented

I think the change is introduced by the new PSR-7 request

Sorry for the delay, feel free to reopen the issue if something go wrong.