FB3lite as a Custom Tag

Last night at work Koen uncovered an issue with using FB3lite as a custom tag.  Inside the tag it does "formUrl2Attributes" to merge the two scopes into the attributes scope.  What I'd done incorrectly was omit the "don't override" parameter to the structAppend calls, so the URL and FORM scopes would supercede any existing attributes for the invocation.

During normal execution this is irrelevant.  It's similarly irrelevant if you don't have a collision between FORM/URL parameters and custom tag attributes.  However, if you do have a collision, the FORM/URL parameter wins, which is clearly incorrect.

To fix this, I added the missing third parameter to structAppend, as well as reversing the lines (so FORM still overrides URL as it always has).  You can grab the source directly, or pull from Subversion.

5 responses to “FB3lite as a Custom Tag”

  1. Peter J. Farrell

    Sounds like you came up with a similar solution to what we did in Mach-II (about six years ago):

  2. Peter J. Farrell

    Darn, need to escape the chevrons…

    <cfset var overwriteFormParams = (getParameterPrecedence() EQ "url") />

    <!— Build event args from form/url/SES —>
    <cfset StructAppend(eventArgs, form) />
    <cfset StructAppend(eventArgs, url, overwriteFormParams) />
    <cfset StructAppend(eventArgs, getAppManager().getRequestManager().parseSesParameters(cgi.PATH_INFO), overwriteFormParams) />

  3. DeepDown

    This is cool, I am finalising a similar project at the moment which is cfc based and implements the same features. Your code is really small though :)