Conversion from CF10

53 views
Skip to first unread message

Sid Wing

unread,
Feb 27, 2016, 1:42:55 PM2/27/16
to Lucee
I am converting a legacy app (that has been running under ACF10 - Fusebox 4) to Lucee.  

One of the very first errors I received was regarding this bit of code:
--------------------
function br_link(fuseaction, title, url, tooltip)
{
var s = StructNew();
s.fuseaction = fuseaction;
s.title = title;
s.url = url & "&br=1";
s.tooltip = tooltip;

return s;
}
----------------------
It would throw an error on the line:
s.url = serialize(url) & "&br=1";

and the error it would throw is:
Use Built-In-Function "serialize(Struct):String" to create a String from Struct

So - I edited this function to:
--------------------
function br_link(fuseaction, title, url, tooltip)
{
var s = StructNew();
s.fuseaction = fuseaction;
s.title = title;
s.url = serialize(url) & "&br=1";
s.tooltip = tooltip;

return s;
}
----------------------
And that seemed to fix the issue for THAT error. 

But - as all the fuseactions/fusearguments are passed in the URL - I am finding more and more of these "Use Built-in Function..." errors that all have some relation to the URL.

Has anyone else seen this issue with older FuseBox applications running under Lucee?

I can post other code examples - if that would help...

Nando Breiter

unread,
Feb 27, 2016, 1:55:03 PM2/27/16
to lu...@googlegroups.com
I'm surprised that works in CF10, if url is indeed a struct that is being passed into that function. Logically, string concatenation shouldn't work with a struct, but maybe ACF coerces it some way.

If it is a string, then I'd suggest changing the url argument to another name so Lucee doesn't treat it as the url scope.



Aria Media Sagl
+41 (0)76 303 4477 cell
skype: ariamedia

--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/9bcdb723-4fff-4e4d-bcf5-1c5280d718a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Igal @ Lucee.org

unread,
Feb 27, 2016, 1:59:11 PM2/27/16
to lu...@googlegroups.com
I'm not familiar with Fusebox, but are you trying to add the URL scope or the argument named url?  if it's the argument, then do:

  s.url - arguments.url & "&br=1";

on a separate subject -- you'd get better performance if you modify your code like so:

function br_link(fuseaction, title, url, tooltip)
{
var s = {

  fuseaction : arguments.fuseaction
,title : arguments.title
,url : arguments.url & "&br=1"
,tooltip : arguments.tooltip
    };
return s;
}

if you want to squeeze even more performance then you can get rid of the local variable "s", and simply do:

return { ... };

Igal Sapir
Lucee Core Developer
Lucee.org

Sid Wing

unread,
Feb 27, 2016, 2:06:35 PM2/27/16
to Lucee
Igal,

That change of yours worked!  And now that a "fresh set of eyes" as looked at it (namely YOURS) - I see it is indeed a "scoping issue".  Lucee was seeing "url" and reading the URL scope rather than the argument.url.  VAR scoping is IMPORTANT!

Nando -

That code has been running in CF10 for a few years now - with no issues whatsoever.  Sometimes ACF is TOO forgiving with poorly scoped variables.

Sid Wing

unread,
Feb 27, 2016, 2:46:08 PM2/27/16
to Lucee
UGH!  They have done this sort of thing "everywhere" in this app...  I "hate" inheriting someone else's code when it looks like this!
Reply all
Reply to author
Forward
0 new messages