Closed danydev closed 6 years ago
Good spot, thanks for this and apologies for breaking it the first place. Appreciate the test case so hopefully this won't happen again. I'll get a new tagged release out today.
Thank you! keep up with the great work!
After the functionality introduced in this PR https://github.com/dwightwatson/validating/pull/180 the semantic of the additional params of the 'NULL' string changed in a way that is not BC. This leads to produced queries that are not equivalent.
If I have a rule like
unique:users,user_id,1,id,deleted,null
what happens inprepareUniqueRule
is that in$parameters
the stringnull
is replaced by aNULL
value (returned by the model) and when the rule is generated by imploding$parameters
, theNULL
value is converted to an empty string, changing (and breaking) the semantic of the query.The query produced by the broken rules goes from
to
This fix makes sure that NULL values returned by models are maintained as
'NULL'
(as string), so that the resulting query matches our expectation.