isNull issue in ACF

Description

Edit-- basically this sort of code DOES NOT WORK on Adobe ColdFusion like it does on Lucee Server and we need to change how we call it

if ( isNull( modules[ arguments.moduleName ] ) ) {

Lucee (and BoxLang) will evaluate modules[ arguments.moduleName ] ) safely and never throw an exception. Adobe does not do this and the only reason this code has worked for so long is because we got lucky that the key exists 99.99% of the time.

That if statement (and any like it) needs to be refactored to use a combination of structKeyExists() and isNull() instead.

if ( !structKeyExists( modules, arguments.moduleName ) || isNull( modules[ arguments.moduleName ] ) ) {

Element CBSTORAGES is undefined in a CFML structure referenced as part of an expression.

The error occurred in E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 513
Called from E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 544
Called from E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 541
Called from E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 544
Called from E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 541
Called from E:/sites/apistaging1/coldbox/system/web/services/ModuleService.cfc: line 486
Called from E:/sites/apistaging1/coldbox/system/web/services/LoaderService.cfc: line 91
Called from E:/sites/apistaging1/coldbox/system/Bootstrap.cfc: line 110
Called from E:/sites/apistaging1/Application.cfc: line 35
511 :
512 : // If module not registered, throw exception
513 : if ( isNull( modules[ arguments.moduleName ] ) ) {
514 : throw(
515 : message: "Cannot activate module: #arguments.moduleName#. Already processed #structKeyList( modules )#",
Resources:

Activity

Show:

Brad Wood November 7, 2024 at 10:30 PM

Luis Majano November 6, 2024 at 7:04 PM

Shouldn't we put a ticket with Adobe to fix their stuff

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

Details

Assignee

Reporter

Priority

Sentry

Created November 5, 2024 at 8:27 PM
Updated November 7, 2024 at 10:30 PM