Skip to content

Commit 472466e

Browse files
authored
Revert "[8.x] Protect against ambiguous columns (#43278)" (#43362)
This reverts commit a6d9307.
1 parent 1b3b06e commit 472466e

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/Illuminate/Auth/EloquentUserProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function retrieveById($identifier)
4949
$model = $this->createModel();
5050

5151
return $this->newModelQuery($model)
52-
->where($model->qualifyColumn($model->getAuthIdentifierName()), $identifier)
52+
->where($model->getAuthIdentifierName(), $identifier)
5353
->first();
5454
}
5555

@@ -65,7 +65,7 @@ public function retrieveByToken($identifier, $token)
6565
$model = $this->createModel();
6666

6767
$retrievedModel = $this->newModelQuery($model)->where(
68-
$model->qualifyColumn($model->getAuthIdentifierName()), $identifier
68+
$model->getAuthIdentifierName(), $identifier
6969
)->first();
7070

7171
if (! $retrievedModel) {

tests/Auth/AuthEloquentUserProviderTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public function testRetrieveByIDReturnsUser()
2222
$mock = m::mock(stdClass::class);
2323
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
2424
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
25-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
26-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
25+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
2726
$mock->shouldReceive('first')->once()->andReturn('bar');
2827
$provider->expects($this->once())->method('createModel')->willReturn($mock);
2928
$user = $provider->retrieveById(1);
@@ -40,8 +39,7 @@ public function testRetrieveByTokenReturnsUser()
4039
$mock = m::mock(stdClass::class);
4140
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
4241
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
43-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
44-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
42+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
4543
$mock->shouldReceive('first')->once()->andReturn($mockUser);
4644
$provider->expects($this->once())->method('createModel')->willReturn($mock);
4745
$user = $provider->retrieveByToken(1, 'a');
@@ -55,8 +53,7 @@ public function testRetrieveTokenWithBadIdentifierReturnsNull()
5553
$mock = m::mock(stdClass::class);
5654
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
5755
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
58-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
59-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
56+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
6057
$mock->shouldReceive('first')->once()->andReturn(null);
6158
$provider->expects($this->once())->method('createModel')->willReturn($mock);
6259
$user = $provider->retrieveByToken(1, 'a');
@@ -81,8 +78,7 @@ public function testRetrieveByBadTokenReturnsNull()
8178
$mock = m::mock(stdClass::class);
8279
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
8380
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
84-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
85-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
81+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
8682
$mock->shouldReceive('first')->once()->andReturn($mockUser);
8783
$provider->expects($this->once())->method('createModel')->willReturn($mock);
8884
$user = $provider->retrieveByToken(1, 'a');

0 commit comments

Comments
 (0)