Super Scope is Lost When UDF in child class from closure in parent class

Description

I am not entirely sure how to write a reproducible test case, but the super scope appears to disappear in Testbox when a call to a method at the third level of inheritance uses it. I don’t believe this is ORM related but the stack and link below are from that module. The stack trace is weird too, because it’s not a failure in Assertion.cfc:20 but the super reference, I believe is the call to super.fail
This line of code consistently fails with the error:

Activity

Brad WoodMarch 12, 2025 at 7:10 PM

For this to happen, you need a closure in a parent class that invokes a method in the child class, which uses super. The issue is that the closure passes its class context (of the parent class) along to the UDF, and when the UDF calls super, it does so from the parent class, not the child class.

Brad WoodMarch 11, 2025 at 8:04 PM

Ahh, I see- it’s just literally called right here

I think the issue is then that we have a function that calls a closure that calls a function and we’re not passing along the proper context of the class we’re in. I’ll try to see if I can repro based on that.

Jon ClausenMarch 11, 2025 at 6:39 PM

it seems AOP is at play here and likely the source of the issue

In this case, I don’t think it is - unless I’m missing something. Luis named the function $transactioned so it is actually a private function in the top-level parent of BaseORMService

Brad WoodMarch 11, 2025 at 6:32 PM

Looking at the stack trace, it seems AOP is at play here and likely the source of the issue. If you look at the stack, the error is actually coming from

boxgenerated.boxclass.cborm.models.Baseormservice$cfc$Func_$transactioned

I'm not entirely sure how to distill this down to a reproducible case, but the most likely source of the issue is that when the AOP wrapper invokes the target UDF, it no longer knows that it is inside of a class. This is generally how UDFs works-- once their reference is removed from the class, passed else where, and executed, they are now standalone and have no ties to the class they used to live in. CF may have some special logic in place that allows this to work. Or perhaps, the context just isn’t being passed in correctly. I’ll need to try and get a distilled repro case for this, but I think the AOP mixin is prolly the key.

Jon ClausenMarch 8, 2025 at 5:25 PM
Edited

I’ve updated the stack trace to the original, before the the fail call. The super scope is lost here, in VirtualEntityService.

The inheritance chain is:
ActiveUser ← ActiveEntity ← VirtualEntityService ← BaseORMService

What is weird is that this is the only one I’ve found that fails on the super method invocation.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created March 6, 2025 at 1:10 AM
Updated March 12, 2025 at 7:10 PM
Resolved March 12, 2025 at 7:10 PM