I have a bug in the bootstrap when there’s errors on loading. A user reports it in detail and I need you to review what they did and see if this is the right approach to solve this.
Found the bug. appHash is param'd inside loadColdBox() (line 81), but reloadChecks() uses #appHash# on line 150 — and if ColdBox has never been fully initialized (e.g. first request, or after a server restart), loadColdBox() may not have run yet, so appHash doesn't exist in variables scope when reloadChecks() tries to use it.
The fix is to ensure appHash is set before it's used in reloadChecks(). The cleanest approach is to move the param to a shared location — either into reloadChecks() itself or into a common initialization block.
Read
Bootstrap.cfc
The issue is clear: appHash is param'd at line 81 inside loadColdBox(), but all other params for the component live at lines 31–37 (component-level). So if reloadChecks() is called before loadColdBox() runs (which happens when the app starts and reloadChecks() is invoked first), appHash is never set.
The fix: move the appHash param to the component-level param block (lines 31–37), removing it from loadColdBox().
Edited
Bootstrap.cfc
+1
-0
Now remove the duplicate param from inside loadColdBox():
Edited
Bootstrap.cfc
+0
-3
The fix moves the appHash param to component-level scope (alongside the other property params at lines 31–37) so it's guaranteed to be set before reloadChecks() runs, regardless of call order. The param in loadColdBox() was redundant anyway since param is a no-op if the variable already exists.
I have a bug in the bootstrap when there’s errors on loading. A user reports it in detail and I need you to review what they did and see if this is the right approach to solve this.
Found the bug. appHash is param'd inside loadColdBox() (line 81), but reloadChecks() uses #appHash# on line 150 — and if ColdBox has never been fully initialized (e.g. first request, or after a server restart), loadColdBox() may not have run yet, so appHash doesn't exist in variables scope when reloadChecks() tries to use it.
The fix is to ensure appHash is set before it's used in reloadChecks(). The cleanest approach is to move the param to a shared location — either into reloadChecks() itself or into a common initialization block.
Read
Bootstrap.cfc
The issue is clear: appHash is param'd at line 81 inside loadColdBox(), but all other params for the component live at lines 31–37 (component-level). So if reloadChecks() is called before loadColdBox() runs (which happens when the app starts and reloadChecks() is invoked first), appHash is never set.
The fix: move the appHash param to the component-level param block (lines 31–37), removing it from loadColdBox().
Edited
Bootstrap.cfc
+1
-0
Now remove the duplicate param from inside loadColdBox():
Edited
Bootstrap.cfc
+0
-3
The fix moves the appHash param to component-level scope (alongside the other property params at lines 31–37) so it's guaranteed to be set before reloadChecks() runs, regardless of call order. The param in loadColdBox() was redundant anyway since param is a no-op if the variable already exists.