ColdBox BE - CookieStorage Plugin lost default value on getVar()

I was just trying out the bleeding edge dev branch, and I noticed a change that broke my app. The getVar() method in the CookieStorage plugin use to have a default attribute of “” on the “default” argument. That meant that

gePlugin(“CookieStorage”).getVar(“ITotallyDontExist”)

used to return an empty string. Now, it throws an error.

I can put in an internal ticket to go back and modify my app to either pass in the default value explicitly, or to always call exists() first, but I wanted to check and see if this change was intentional or not, and if it was to ensure it makes it in the compatibility guide.

Here’s the commit that introduced the change in behavior:
https://github.com/ColdBox/coldbox-platform/commit/ce391b4ecbc0af600acbdf768fb37625f0cc5a01#L0L118

Thanks!

~Brad

Yes, this was reported Brad. I just think this maybe should be the desired effect, as you are requesting a non-existent variable but receiving an empty string.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

> you are requesting a non-existent variable but receiving an empty string.

Well yes, you just described the behavior of a default value in action. The real question is whether or there should be a default “default” value. :slight_smile:

I’m fine with the new approach. I think it’s cleaner and a bit less presumptuous. Just make sure it makes it in the compatibility guide and we’ll be good.

Thanks!

~Brad

Ok, sounds good! Also, it has to be consistent across all storage plugins. So maybe this is a candidate for the 3.5.2 release plus your instance issues.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano