Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ public function except($keys)
*/
public function intersect($keys)
{
return array_filter($this->only(is_array($keys) ? $keys : func_get_args()));
return array_intersect_key($this->all(), array_flip($keys));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/HttpRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ public function testExceptMethod()

public function testIntersectMethod()
{
$request = Request::create('/', 'GET', ['name' => 'Taylor', 'age' => null]);
$this->assertEquals(['name' => 'Taylor'], $request->intersect('name', 'age', 'email'));
$request = Request::create('/', 'GET', ['a' => 'a', 'b' => '', 'c' => null, 'd' => false, 'e' => 0, 'f' => 'foo']);
$this->assertEquals(['a' => 'a', 'b' => '', 'c' => null, 'd' => false, 'e' => 0], $request->intersect(['a', 'b', 'c', 'd', 'e']));
}

public function testQueryMethod()
Expand Down