From 472466e4b67273e3a9f092a0f667ba7689651a3d Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Fri, 22 Jul 2022 13:16:00 +0200 Subject: [PATCH 1/2] Revert "[8.x] Protect against ambiguous columns (#43278)" (#43362) This reverts commit a6d93077216e35b8216dc03cba1f0219a5c0dfda. --- src/Illuminate/Auth/EloquentUserProvider.php | 4 ++-- tests/Auth/AuthEloquentUserProviderTest.php | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index b945cd486d54..54dff6b87f2c 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -49,7 +49,7 @@ public function retrieveById($identifier) $model = $this->createModel(); return $this->newModelQuery($model) - ->where($model->qualifyColumn($model->getAuthIdentifierName()), $identifier) + ->where($model->getAuthIdentifierName(), $identifier) ->first(); } @@ -65,7 +65,7 @@ public function retrieveByToken($identifier, $token) $model = $this->createModel(); $retrievedModel = $this->newModelQuery($model)->where( - $model->qualifyColumn($model->getAuthIdentifierName()), $identifier + $model->getAuthIdentifierName(), $identifier )->first(); if (! $retrievedModel) { diff --git a/tests/Auth/AuthEloquentUserProviderTest.php b/tests/Auth/AuthEloquentUserProviderTest.php index a16f1f322cac..ae34a1b4a074 100755 --- a/tests/Auth/AuthEloquentUserProviderTest.php +++ b/tests/Auth/AuthEloquentUserProviderTest.php @@ -22,8 +22,7 @@ public function testRetrieveByIDReturnsUser() $mock = m::mock(stdClass::class); $mock->shouldReceive('newQuery')->once()->andReturn($mock); $mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id'); - $mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id'); - $mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock); + $mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock); $mock->shouldReceive('first')->once()->andReturn('bar'); $provider->expects($this->once())->method('createModel')->willReturn($mock); $user = $provider->retrieveById(1); @@ -40,8 +39,7 @@ public function testRetrieveByTokenReturnsUser() $mock = m::mock(stdClass::class); $mock->shouldReceive('newQuery')->once()->andReturn($mock); $mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id'); - $mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id'); - $mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock); + $mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock); $mock->shouldReceive('first')->once()->andReturn($mockUser); $provider->expects($this->once())->method('createModel')->willReturn($mock); $user = $provider->retrieveByToken(1, 'a'); @@ -55,8 +53,7 @@ public function testRetrieveTokenWithBadIdentifierReturnsNull() $mock = m::mock(stdClass::class); $mock->shouldReceive('newQuery')->once()->andReturn($mock); $mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id'); - $mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id'); - $mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock); + $mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock); $mock->shouldReceive('first')->once()->andReturn(null); $provider->expects($this->once())->method('createModel')->willReturn($mock); $user = $provider->retrieveByToken(1, 'a'); @@ -81,8 +78,7 @@ public function testRetrieveByBadTokenReturnsNull() $mock = m::mock(stdClass::class); $mock->shouldReceive('newQuery')->once()->andReturn($mock); $mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id'); - $mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id'); - $mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock); + $mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock); $mock->shouldReceive('first')->once()->andReturn($mockUser); $provider->expects($this->once())->method('createModel')->willReturn($mock); $user = $provider->retrieveByToken(1, 'a'); From 96aecced5126d48e277e5339193c376fe82b6565 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 22 Jul 2022 09:16:24 -0500 Subject: [PATCH 2/2] version --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 33ed78359076..bf3d21c34e80 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig * * @var string */ - const VERSION = '8.83.21'; + const VERSION = '8.83.22'; /** * The base path for the Laravel installation.