diff --git a/src/Illuminate/Database/Connectors/ConnectionFactory.php b/src/Illuminate/Database/Connectors/ConnectionFactory.php index 564a9018033d..d998a41845fe 100755 --- a/src/Illuminate/Database/Connectors/ConnectionFactory.php +++ b/src/Illuminate/Database/Connectors/ConnectionFactory.php @@ -11,7 +11,6 @@ use Illuminate\Database\PostgresConnection; use Illuminate\Database\SqlServerConnection; use Illuminate\Contracts\Container\Container; -use Illuminate\Contracts\Debug\ExceptionHandler; class ConnectionFactory { @@ -182,9 +181,7 @@ protected function createPdoResolverWithHosts(array $config) try { return $this->createConnector($config)->connect($config); } catch (PDOException $e) { - if (count($hosts) - 1 === $key && $this->container->bound(ExceptionHandler::class)) { - $this->container->make(ExceptionHandler::class)->report($e); - } + continue; } } diff --git a/tests/Integration/Auth/ApiAuthenticationWithEloquentTest.php b/tests/Integration/Auth/ApiAuthenticationWithEloquentTest.php new file mode 100644 index 000000000000..4553b275be43 --- /dev/null +++ b/tests/Integration/Auth/ApiAuthenticationWithEloquentTest.php @@ -0,0 +1,51 @@ +set('app.debug', 'true'); + + // Auth configuration + $app['config']->set('auth.defaults.guard', 'api'); + $app['config']->set('auth.providers.users.model', User::class); + + // Database configuration + $app['config']->set('database.default', 'testbench'); + + $app['config']->set('database.connections.testbench', [ + 'driver' => 'mysql', + 'host' => env('DB_HOST', '127.0.0.1'), + 'username' => 'root', + 'password' => 'invalid-credentials', + 'database' => 'forge', + 'prefix' => '', + ]); + } + + /** + * @test + */ + public function authentication_via_api_with_eloquent_using_wrong_database_credentials_should_not_cause_infinite_loop() + { + Route::get('/auth', function () { + return 'success'; + })->middleware('auth:api'); + + $this->expectException(QueryException::class); + + $this->expectExceptionMessage("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from `users` where `api_token` = whatever limit 1)"); + + $this->withoutExceptionHandling()->get('/auth', ['Authorization' => 'Bearer whatever']); + } +} + +class User extends \Illuminate\Foundation\Auth\User +{ +} diff --git a/tests/Integration/Database/EloquentRelationshipsTest.php b/tests/Integration/Database/EloquentRelationshipsTest.php index e841995c3422..b73e35390b00 100644 --- a/tests/Integration/Database/EloquentRelationshipsTest.php +++ b/tests/Integration/Database/EloquentRelationshipsTest.php @@ -22,7 +22,6 @@ class EloquentRelationshipsTest extends TestCase { /** * @test - * @group f */ public function standard_relationships() { @@ -41,7 +40,6 @@ public function standard_relationships() /** * @test - * @group f */ public function overridden_relationships() {