Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Jason F. / ()
Created: 05/21/2019
Components: Language, Framework Support
Versions: 2018
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2018,0,03,314033 / CF2016U12,CF2018U5
Priority/Frequency: Normal / Most users will encounter
Locale/System: English / Windows 10 64 bit
Vote Count: 4
Problem Description: Frameworks such as ColdBox use mappings to allow for portable modules. In ColdFusion 2018, application-specific mappings do not register correctly until an additional getApplicationMetadata() is called.
Steps to Reproduce:
Create a folder at the web root containing the following two files:
Application.cfc:
component {
this.mappings['/coldbox'] = 'someFolder/coldbox';
}
index.cfm:
<cfscript>
public void function setMappings() {
var metadata = getApplicationMetadata();
metadata.mappings['/cbantisamy'] = 'C:\someOtherFolder/cbantisamy';
}
// The only custom mapping at this point should be to /coldbox
WriteOutput('<p>' & expandPath( '/cbantisamy' ) & '<br />' & expandPath( '/coldbox' ) & '</p>');
// We set an application-specific mapping using application metadata
setMappings();
// Expected: cbantisamy has a new mapping
// Actual: Mappings have not changed!
WriteOutput('<p>' & expandPath( '/cbantisamy' ) & '<br />' & expandPath( '/coldbox' ) & '</p>');
// Call getApplicationMetadata() an additional time
getApplicationMetadata();
// Mappings have suddenly changed!
WriteOutput('<p>' & expandPath( '/cbantisamy' ) & '<br />' & expandPath( '/coldbox' ) & '</p>');
</cfscript>
Navigate to index.cfm in ColdFusion 2018 and compare its results to the results obtained in ColdFusion 2016 or ColdFusion 11.
Actual Result:
In ColdFusion 2018, cbantisamy does not have a correct mapping until getApplicationMetadata() is called an additional time.
Expected Result:
The new mapping for '/cbantisamy' should appear immediately after it is set in the setMappings function, just as it does in ColdFusion 2016 or ColdFusion 11.
Any Workarounds:
Add an additional getApplicationMetadata() before attempting to expand a mapped path
Attachments:
Comments: