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

2D Array in URL throws error #836

Closed
michaeldiederich opened this Issue Jan 16, 2018 · 4 comments

Comments

3 participants
@michaeldiederich

michaeldiederich commented Jan 16, 2018

If you want to submit/request a page with an 2D Array as URL arguments, cfwheels (latest master branch) throws an error:

Lucee 5.2.4.37 Error (expression)

Message | Can't cast Object type [Array] to a value of type [Struct]
Detail | Java type of the object is lucee.runtime.type.ArrayImpl
Stacktrace | The Error Occurred in/home/[....]/wheels/dispatch/functions.cfm:
line 62
60: local.item = local.nested[local.i];
61: 
62: if (!StructKeyExists(local.struct, local.item)) {
63: local.struct[local.item] = {};
64: }

See attached screenshot for the parameters, example url:

http://[..]/index.cfm/kunde/overview?format=json&filter[0][]=firma_1&filter[0][]=contains&filter[0][]=preis&filter[]=and&filter[2][]=extern_id&filter[2][]=contains&filter[2][]=1&skip=0&take=12&reload=true

965c8390623818ebb9aefbe12c5891e21ae875ee43d800ced7 pimgpsh_fullsize_distr

@neokoenig

This comment has been minimized.

Member

neokoenig commented Jan 16, 2018

This never worked in 1.4.x though did it? (As in, this isn't something which used to work and is now broken?)

$createNestedParamStruct() also handles form submissions such as organisation[organisationcategories][6,5][_delete] with hasManyCheckbox(), so I wonder if that's the issue - i.e, it's always expecting a struct

@michaeldiederich

This comment has been minimized.

michaeldiederich commented Jan 16, 2018

I never used 1.4.x.

@perdjurner perdjurner self-assigned this Jan 17, 2018

@perdjurner perdjurner added the bug label Jan 17, 2018

@perdjurner perdjurner added this to the 2.0.1 milestone Jan 17, 2018

@michaeldiederich

This comment has been minimized.

michaeldiederich commented Jan 22, 2018

Just to make sure: Why don't you parse the argument item and e.g. cast each of the array elements to the returning struct?

@perdjurner

This comment has been minimized.

Contributor

perdjurner commented Jan 22, 2018

I don't know enough about how nested properties work, or are supposed to work, so all I did was work around the error itself (then at least the parameters will be available in the form / url scopes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment