Allow a way to disable Array Delimiters #914
Unanswered
Spice-King
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Bumped into an issue in production where someone dumped a comma into a search box, ended up throwing an exception as it was a callback filter that had typed parameters setting the value to be a string and not an array.
Few options come to mind, like setting it to
false
or an empty string (which does work right now, but I consider it to be a byproduct of happenstance that ``Str::contains` always returns false for an empty string as a search, thus not exploding the string, and not a proper documented feature) to disable it.Another option is to provide a way to escape the delimiter so that the issue can be avoided. This kinda feels like a bandaid more than a fix.
The last option is to look at the passed in closure to see if it expects a single value (string, int, float, boolean, etc) or an array, then exploding if it's an array. This would at least be consistent with for times that there might be either a single or multiple values being both arrays for the callback.
I'm just going to abuse the empty string option for now, but it feels more jank than I'd expect for something in Laravel..
Beta Was this translation helpful? Give feedback.
All reactions