Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:5.4from
jeffersonsetiawan:5.4
Feb 3, 2017
Merged

[5.4] TrimString Middleware bugfixes (using strict comparison instead of loose comparison)#17741
taylorotwell merged 1 commit into
laravel:5.4from
jeffersonsetiawan:5.4

Conversation

@jeffersonsetiawan
Copy link
Copy Markdown
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