Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null properties cause create/update to fail #507

Closed
andybellenie opened this issue Jul 2, 2015 · 6 comments
Closed

Null properties cause create/update to fail #507

andybellenie opened this issue Jul 2, 2015 · 6 comments
Labels

Comments

@andybellenie
Copy link
Contributor

It is possible to have a null value in CF (e.g. returned from a JSON object). Passing in a properties struct with null keys will cause an error:

<cfset test = {title = javaCast("null", 0)}>
<cfset model("payment").new(properties=test)>
@perdjurner
Copy link
Contributor

Do you get this error?

"Element TITLE is undefined in a CFML structure referenced as part of an expression"

@perdjurner
Copy link
Contributor

The following fixes (well, it skips setting the property) for me on CF 8:

Wrap line 400 in properties.cfm with:

if (StructKeyExists(arguments.properties, loc.key))
{
loc.rv[loc.key] = arguments.properties[loc.key];
}

@perdjurner perdjurner added the bug label Jul 2, 2015
@perdjurner perdjurner added this to the 1.5 milestone Jul 2, 2015
@andybellenie
Copy link
Contributor Author

No I get:
"the value from key [TITLE] is NULL, which is the same as not existing in CFML"

This is a Railo error

@andybellenie
Copy link
Contributor Author

I think we should wrap the whole block inside the loop, there's no need to take any action when the key is null

@perdjurner
Copy link
Contributor

I agree.

@perdjurner
Copy link
Contributor

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants