Skip to content
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

[5.4] TrimString Middleware bugfixes (using strict comparison instead of loose comparison) #17741

Merged
merged 1 commit into from
Feb 3, 2017

Conversation

jeffersonsetiawan
Copy link
Contributor

@jeffersonsetiawan jeffersonsetiawan commented Feb 3, 2017

I found bug on the laravel framework on TrimString Middleware. It used loose comparison.

For Example:

<html>
<body>
<form method="POST">
    <input type="text" name="foo[]">
    <input type="text" name="foo[]">
    <input type="submit" value="submit">
</form>
</body>
</html>

If we use the loose comparison, the first input will not be trimmed because method:
in_array(0, $this->except)

always return true (comparing 0 with string).

if we use strict comparison (by adding true for the 3rd argument), it will be fixed.
in_array($key, $this->except, true)

@jeffersonsetiawan jeffersonsetiawan changed the title TrimString Middleware bugfixes (using strict comparison instead of loose comparison) [5.4] TrimString Middleware bugfixes (using strict comparison instead of loose comparison) Feb 3, 2017
@taylorotwell taylorotwell merged commit a67aeeb into laravel:5.4 Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants