I've just ran into this bug and discovered a little workaround.
This will result in buggy behaviour as described (default value will always
be assigned):
function DateTimeFormatted(d=Now()) {...}
This will work correctly:
function DateTimeFormatted(d="#Now()#") {...}
Regards
Louis
Am Donnerstag, 29. Dezember 2011 19:08:22 UTC+1 schrieb Billy Cravens:
>
> OSX 10.7.2, Open BD 2.0.1 Desktop
>
> Issue 403: http://code.google.com/p/openbluedragon/issues/detail?id=403
>
> Billy Cravens
> [email protected] <javascript:>
>
>
>
> On Dec 29, 2011, at 12:04 PM, Peter J. Farrell wrote:
>
> What version of OpenBD and link to the bug ticket?
>
> Billy Cravens said the following on 12/29/2011 12:03 PM:
>
> Just an FYI, bug report to proper issue tracker, just wanted to make
> community aware (and tell me if there's something I'm missing!)
>
> Billy Cravens
> [email protected] <javascript:>
>
>
>
> On Dec 29, 2011, at 11:57 AM, Billy Cravens wrote:
>
> In some of my CFC's, I define my functions in script (since I've written
> script-based CFCs in Railo/ACF, quickest port was to wrap in <cfscript> and
> <cfcomponent>)
>
> Noticed some odd behavior when my function has multiple params with
> defaults, and I explicitly set a value other than the first param.
>
>
> Code for reference:
>
> obj.cfc:
> <cfcomponent>
> <cfscript>
> function foo(a=1,b=2,c=3) {
> writedump(arguments); // contrived little example
> }
> </cfscript>
> </cfcomponent>
>
> test.cfm:
> <cfscript>
> myObj = new obj();
> myObj.foo();
> myObj.foo(a=4); // works correctly
> myObj.foo(b=4); // a disappears, and b unchanged!
> myObj.foo(c=4); // a disappears and c unchanged!
> myObj.foo(b=4,c=5); // a disappears and c unchanged - but b works?
> myObj.foo(c=5, b=4); // despite reversed order, same result as last line
> </cfscript>
>
> When you explicitly set the value of anything other than the first
> param, it loses the first param, and no arguments change. However, if you
> set more than one value, it seems that only the last argument doesn't
> change (first param still missing).
>
> Confirmed that it behaves correctly if you use <cffunction> based
> methods. I can't replicate this bug in UDF's, only CFCs. Bug seems to exist
> whether you're in a method or an implicit constructor (function name
> init(), arguments in new invocation) - I actually discovered this when I
> added a second param to one of my constructors.
>
> The obvious solution is to switch to all <cffunction> methods, but this
> is still a pretty big core bug, IMO.
>
>
> Billy Cravens
> [email protected] <javascript:>
>
>
>
>
> --
> online documentation: http://openbd.org/manual/
> google+ hints/tips: https://plus.google.com/115990347459711259462
> http://groups.google.com/group/openbd?hl=en
>
>
>
> --
> Peter J. [email protected] <javascript:>[email protected]
> <javascript:>http://blog.maestropublishing.comIdenti.ca / Twitter: @maestrofjp
>
>
> --
> online documentation: http://openbd.org/manual/
> google+ hints/tips: https://plus.google.com/115990347459711259462
> http://groups.google.com/group/openbd?hl=en
>
>
>
--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en