Fixed
Details
Assignee
Michael OffnerMichael OffnerReporter
Brad WoodBrad WoodPriority
CriticalFix versions
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
NoneAffects versions
Details
Details
Assignee
Michael Offner
Michael OffnerReporter
Brad Wood
Brad WoodPriority
Fix versions
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
None
Affects versions
Created 21 August 2018 at 22:37
Updated 4 September 2018 at 19:25
Resolved 4 September 2018 at 19:07
Generated accessors keep references to old CFC when mixed into another CFC's variable's scope. This breaks a core feature of ColdBox/WireBox called virtual inheritance were we use mixins to populate a child CFC instance at runtime with properties and methods from a superclass. When we take a reference to a generated accessor from one CFC and place it in the this scope of another CFC, it works fine, but when we place it in the variables scope of the target CFC, the generated accessor method keeps pointing to the old CFC.
Test Case:
foo.cfc
component accessors=true { property name="message"; function init() { variables.message = 'I am foo.cfc!'; } function doSomething() { return getMessage(); } }
bar.cfc
component { variables.message = 'I am bar.cfc!'; function doSomething() { return getMessage(); } }
index.cfm
<cfscript> function injectMixin( name, UDF ) { variables[ arguments.name ] = arguments.UDF; this[ arguments.name ] = arguments.UDF; } objFoo = new foo(); objBar = new bar(); objBar.injectMixin = injectMixin; objBar.injectMixin( 'getMessage', objFoo.getMessage ); // Correct: I am foo.cfc! writeDump( 'Foo externally says: ' & objFoo.getMessage() ); // Correct: I am bar.cfc! writeDump( 'Bar externally says: ' & objBar.getMessage() ); // Correct: I am foo.cfc! writeDump( 'Foo internally says: ' & objFoo.doSomething() ); // INCORRECT: I am foo.cfc! writeDump( 'Bar internally says: ' & objBar.doSomething() ); // INCORRECT: C:\path\to\foo.cfc writeDump( getMetaData( objBar.getMessage ).owner ); </cfscript>