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

Fixed validation for Request parameter that is an array without default value #910

Merged
merged 2 commits into from
Dec 2, 2014

Conversation

eugef
Copy link
Contributor

@eugef eugef commented Nov 22, 2014

If Request parameter is an array without default value and parameter is not set - then an error should be thrown that "parameter value is not an array".

Steps to reproduce:

  • Create a Request parameter with the following config
@RequestParam(name="clients", array=true)
  • In a post request do not send this parameter at all

Actual result (before the fix):

  • 'clients' parameter is set to an empty array

Expected result (with the fix):

  • Error "Request parameter value of 'clients' is not an array"

If empty array should be a default value if parameter is not set, then 'strict' should be set to false, example:

@RequestParam(name="clients", array=true, strict=false)

@eugef eugef changed the title Fix validation for Request parameter that is an array without default value Fixed validation for Request parameter that is an array without default value Nov 23, 2014
…of strict mode

If Request parameter is an array without default value, then an error should be thrown that "parameter value is not an array" in strict mode
@lsmith77
Copy link
Member

can you add a failing test case?

@eugef
Copy link
Contributor Author

eugef commented Nov 23, 2014

@lsmith77, do you want me to add test case that would fail before this fix is applied?

@lsmith77
Copy link
Member

you can do it in this PR .. or even better as a separate PR.

  1. PR with the failing test case
  2. update this PR to include the test case plus your fix

@eugef
Copy link
Contributor Author

eugef commented Nov 23, 2014

Ok, will do it

@lsmith77
Copy link
Member

lsmith77 commented Dec 2, 2014

ping

@eugef
Copy link
Contributor Author

eugef commented Dec 2, 2014

Sorry, was too busy this weekend.

@eugef
Copy link
Contributor Author

eugef commented Dec 2, 2014

Test is added, also separate PR with only failing test is created #915

@lsmith77
Copy link
Member

lsmith77 commented Dec 2, 2014

hmm it seems like the commit in this PR doesn't match the on in #915 ..

@eugef
Copy link
Contributor Author

eugef commented Dec 2, 2014

Well, i cherry-picked commit ec90c29 from 'patch-1' branch into the 'patch-1-test-only'
Or should i did in other way?

@lsmith77
Copy link
Member

lsmith77 commented Dec 2, 2014

hmm not sure why the commit hash is different then .. anyway .. looks good in manual inspection .. thanks!

lsmith77 added a commit that referenced this pull request Dec 2, 2014
Fixed validation for Request parameter that is an array without default value
@lsmith77 lsmith77 merged commit 6714a42 into FriendsOfSymfony:master Dec 2, 2014
@eugef
Copy link
Contributor Author

eugef commented Dec 2, 2014

Ups, seems i had deleted by accident one test case eugef@ec90c29#diff-fbad238da345246612fd46bb2c0323c8L373

What is the best way to add it back? Create another PR?

@lsmith77
Copy link
Member

lsmith77 commented Dec 2, 2014

yeah .. another PR .. thx

@eugef eugef deleted the patch-1 branch December 2, 2014 13:47
@eugef
Copy link
Contributor Author

eugef commented Dec 2, 2014

Done #916, please merge

@lsmith77 lsmith77 added this to the 1.5.0 milestone Jan 27, 2015
@lsmith77
Copy link
Member

lsmith77 commented Feb 5, 2015

@eugef can you have a look at #960 ?

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

Successfully merging this pull request may close these issues.

2 participants