fix throw notice in validators and in CHtml::encode, when value for validate and encode is array #2111

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

liff4 commented Feb 13, 2013

fix throw notice in validators and in CHtml::encode, when value for validate and encode is array

@ghost ghost assigned samdark Feb 13, 2013

Owner

samdark commented Feb 13, 2013

  • Please use tabs instead of spaces.
  • It's better to raise an error instead of silently converting to null.
  • Need a changelog line with issue # sorted properly.

liff4 commented Feb 13, 2013

ok, i create new pull request for with bug and create new issue tomorrow

Owner

samdark commented Feb 13, 2013

You can update this one. No need to create new one each time.

liff4 commented Feb 13, 2013

ok. i only 2 days on github)

Owner

cebe commented Feb 13, 2013

what is this used for? I think it breaks backwards compatibility and is not clean coding way.
How can these values become arrays?

Owner

samdark commented Feb 13, 2013

It should not break BC. Arrays could be passed via URL like &id[]=1&id[]=2.

Owner

cebe commented Feb 13, 2013

Okay, but it is the wrong place for doing it. if attribute gets assigned an array, validator will validate against null and if null is allowed validation will pass.
In model there is still the array and saving might cause a problem.

liff4 commented Feb 13, 2013

cebe. i test my changes very well. Not all validators affect this bug. Yes, may be don`t need set $value in null, and gererate error. But i send my solution.))

Owner

samdark commented Feb 13, 2013

@cebe I'm for checking for arrays but this should trigger an error rather than magically casting to null.

Owner

cebe commented Feb 13, 2013

@cebe I'm for checking for arrays but this should trigger an error rather than magically casting to null.

agree.

Owner

samdark commented Mar 15, 2013

Already fixed in #2186.

@samdark samdark closed this Mar 15, 2013

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