Interceptors that manually extend the base class call super init twice

Description

The InterceptorService always adds virtual inheritance regardless of whether the interceptor extends the base class already. if the interceptor has no init, or has an init that calls super.init(), this causes the super init to be ran twice. Once as part of virtual inheritance and another time as part of the standard CFC building.

For apps that use application helpers, this causes the "Routines cannot be declared more than once." error as application helpers are getting mixed twice.

The interceptor service needs to check and not add virtual inheritance if the interceptor already extends the base class.

Activity

Show:
Luis Majano
September 21, 2016, 8:03 PM

I don't see where the interceptor service would call it twice? I cannot reproduce this

Brad Wood
September 21, 2016, 9:23 PM

Hmm, I can't seem to reproduce the error any longer related to the routines being declared more than once. Maybe Lucee suppresses this warning now. I am able to cause the super init to be run more than once though if I have a mapping to ColdBox with a name other than "/coldbox". I think I ran into this in an ESRI app, where they would have weird stuff like :

In those scenarios, the "isInstance()" check returns false and WireBox does virtual inheritance on top of the built-in inheritance. Either way, I don't think there's a quick fix for this and since it doesn't seem to be causing an error right now (at least not on Lucee), I'll close this ticket.

Brad Wood
March 24, 2017, 10:40 PM

Ran into this issue again today with Tim Farra on Slack. Too forever to track it down but it was due to isInstance() not thinking the interceptor was of type `coldbox.system.Interecptor` (which is was) and running virtual inheritance which caused the base class init to run twice. The issue was resolved when he unchecked "cache component paths" in the CF 11 administrator. coldbox.system.Intereptor seemed to be caching the resolution to a CFC in another app on the same server and making isInstance() return incorrect results.

Luis Majano
March 26, 2017, 4:46 PM

Wow. Not sure what we can do then

Cannot Reproduce

Assignee

Luis Majano

Reporter

Brad Wood

Labels

None

Components

Affects versions

Priority

Major
Configure