Fix bug with handling boolean values in set() method - #4907
Conversation
|
Changing the |
Yes, I understand it isn't an easy change, but I feel that this is the right way to handle this. Unless we want to "force" users to use
Yes, it does. In general, this wasn't working as it should from the beginning. A few things:
The main reason I'm proposing this change is that I strongly feel that using Let me summarize this by a table. Without this PR situation look like this:
If this PR is merged, everything will be fixed. I don't see the better way, but I'm always open to suggestions. |
|
Additionally, there is another problem with the This will cause additional performance hit because the database engine will have to typecast the value, for most of the time it won't be something crucial though. In any case, it prevents the developer from generating the query he expected. |
|
Thank you, that was a very helpful summary and explanation of the issue. I will continue this conversation with the caveat that the database layer is my weakest area and I have very little experience outside of MySQL and Firestore - which means I'm coming at this mostly from a code perspective. I would love some others to chime in as well. I'm not saying I agree with the signature, but it is there and clearly at some point the intent was for input to be strings. Could we go the opposite direction and enforce
|
|
One more alternative: since this is only an issue for MSSQL, we could loosen the signature to |
|
I haven't checked at what point casting for
I think that casting everything to strings would be even more damaging - since it would possibly break applications that are working just fine right now. Please notice that when we call
Not really. It's actually an issue for every driver when we're trying to assign a I understand concerns about removing casting in this method but with proper documentation, it shouldn't cause many issues for developers. I personally think the current implementation is faulty. I look forward to hearing from others. |
paulbalandan
left a comment
There was a problem hiding this comment.
I'm fine with this if this would be the straightforward fix to the issue rather than make convoluted workarounds.
lonnieezell
left a comment
There was a problem hiding this comment.
If @michalsn can get the upgrade doc included in a toctree, I'm good with these changes.
|
@MGatner I guess this is ready to go? |
|
🙈🙉🙊 |
Description
This PR introduces some potential BC but I treat this as a bug that has to be fixed. At the end of the day calling
$builder->set('bool', true);and$builder->set(['bool' => true]);should have the same effect.I have added additional tests for boolean values and upgrade instructions.
Fixes #4761
Checklist: