Skip to content

Commit 5111ffc

Browse files
committed
fix: Lucee/Adobe UDFCasterException on getRouteCachingMetadata() null return
private struct function getRouteCachingMetadata() returned a bare `return;` (null) for the common "route doesn't opt into caching" case. Lucee enforces the declared struct return type strictly and throws UDFCasterException: Cannot cast null value to value of type [struct] on every request, which is why CI failed with 62 TestBox failures on lucee@5/lucee@6 - any spec touching HandlerService (event execution, handler bean lookups, etc) exercises getEventMetadataEntry(), which now always calls this function. Drop the explicit struct return type, matching the same "function that may return null" convention RequestService.cfc's getContextFromScope() already uses elsewhere in this codebase. Runtime behavior is unchanged - callers already null-check with isNull().
1 parent 147971c commit 5111ffc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

system/web/services/HandlerService.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ component extends="coldbox.system.web.services.BaseService" accessors="true" {
825825
* @routeRecord The current request's matched route record, i.e. `event.getCurrentRouteRecord()`. An empty struct when no route matched.
826826
* @requestContext The request context for the current request, passed to a closure `cacheSuffix` untouched.
827827
*/
828-
private struct function getRouteCachingMetadata( required struct routeRecord, required requestContext ){
828+
private function getRouteCachingMetadata( required struct routeRecord, required requestContext ){
829829
if ( !arguments.routeRecord.keyExists( "cache" ) || !arguments.routeRecord.cache ) {
830830
return;
831831
}

0 commit comments

Comments
 (0)