-
Notifications
You must be signed in to change notification settings - Fork 75
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
ESubDocumentValidator stopped working properly #192
Comments
I'll take a look thanks |
Sorry for the delay, Can you show me a bit of your model code? Enough to understand how you have set this up. |
like this? here are the settings for validation for this attribute:
|
Hmm there is no rule for type there, by default Yii will only set |
I think that might why this is happening because the codde change allows for filters to be used but sacrifices the ability to just send in random data and get it back again. Now it all has to be validated and if it doesn't validate correctly as a field that should be there it will be omitted since of course |
does it mean that i have to declare safe validation rule for every subarray stage? if yes, it would be difficult, cause i have dynamic subarray configuration |
Hmm Unfortunately the only way to get aorund this is to not actually validate what fields you have in that array. I realised this in my last message, that the subdocument validator, before that fix, potentially would allow unsafe fields through to the database. This is a very difficult one to solve. I am quite unsure how to solve it without either producing a security risk or making people unhappy. |
Maybe you should try to create the paramater, that would define the validator behavior? If people consciously permit a security risk, they would get what they want) |
Yeah I can do that, so long as it is ok to have to add a param to the rules required? How about |
It's ok, I think. You just need to warn about this param. |
Try that out: 2fe8a99 Let me know if it works |
It works, thanks |
Sweet I'll release it then thanks :) |
Hi! After last upgrade I've found, that some fileds in my model were not saving. I investigated this problem and found, that the reason lied in ESubdocumentValidator. And everything started to work only after commenting the following rows:
and of course changing
$object->$attribute = $newFieldValue;
back to
$object->$attribute = $fieldValue;
Symptoms of this bug (I think, it's bug) are following: I had a very complex array for this attribute, like
and validator gave me back
The text was updated successfully, but these errors were encountered: