Skip to content

Commit a87cf9b

Browse files
committed
Merge branch '5.6' of github.com:laravel/framework into 5.6
2 parents 857ec94 + 57d7b1f commit a87cf9b

File tree

4 files changed

+53
-13
lines changed

4 files changed

+53
-13
lines changed

src/Illuminate/Database/Connectors/ConnectionFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Illuminate\Database\PostgresConnection;
1212
use Illuminate\Database\SqlServerConnection;
1313
use Illuminate\Contracts\Container\Container;
14-
use Illuminate\Contracts\Debug\ExceptionHandler;
1514

1615
class ConnectionFactory
1716
{
@@ -182,9 +181,7 @@ protected function createPdoResolverWithHosts(array $config)
182181
try {
183182
return $this->createConnector($config)->connect($config);
184183
} catch (PDOException $e) {
185-
if (count($hosts) - 1 === $key && $this->container->bound(ExceptionHandler::class)) {
186-
$this->container->make(ExceptionHandler::class)->report($e);
187-
}
184+
continue;
188185
}
189186
}
190187

src/Illuminate/Http/Request.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,7 @@ public function segments()
184184
*/
185185
public function is(...$patterns)
186186
{
187-
foreach ($patterns as $pattern) {
188-
if (Str::is($pattern, $this->decodedPath())) {
189-
return true;
190-
}
191-
}
192-
193-
return false;
187+
return Str::is($patterns, $this->decodedPath());
194188
}
195189

196190
/**
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace Illuminate\Tests\Integration\Auth\ApiAuthenticationWithEloquentTest;
4+
5+
use Orchestra\Testbench\TestCase;
6+
use Illuminate\Support\Facades\Route;
7+
use Illuminate\Database\QueryException;
8+
9+
class ApiAuthenticationWithEloquentTest extends TestCase
10+
{
11+
protected function getEnvironmentSetUp($app)
12+
{
13+
$app['config']->set('app.debug', 'true');
14+
15+
// Auth configuration
16+
$app['config']->set('auth.defaults.guard', 'api');
17+
$app['config']->set('auth.providers.users.model', User::class);
18+
19+
// Database configuration
20+
$app['config']->set('database.default', 'testbench');
21+
22+
$app['config']->set('database.connections.testbench', [
23+
'driver' => 'mysql',
24+
'host' => env('DB_HOST', '127.0.0.1'),
25+
'username' => 'root',
26+
'password' => 'invalid-credentials',
27+
'database' => 'forge',
28+
'prefix' => '',
29+
]);
30+
}
31+
32+
/**
33+
* @test
34+
*/
35+
public function authentication_via_api_with_eloquent_using_wrong_database_credentials_should_not_cause_infinite_loop()
36+
{
37+
Route::get('/auth', function () {
38+
return 'success';
39+
})->middleware('auth:api');
40+
41+
$this->expectException(QueryException::class);
42+
43+
$this->expectExceptionMessage("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from `users` where `api_token` = whatever limit 1)");
44+
45+
$this->withoutExceptionHandling()->get('/auth', ['Authorization' => 'Bearer whatever']);
46+
}
47+
}
48+
49+
class User extends \Illuminate\Foundation\Auth\User
50+
{
51+
}

tests/Integration/Database/EloquentRelationshipsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class EloquentRelationshipsTest extends TestCase
2222
{
2323
/**
2424
* @test
25-
* @group f
2625
*/
2726
public function standard_relationships()
2827
{
@@ -41,7 +40,6 @@ public function standard_relationships()
4140

4241
/**
4342
* @test
44-
* @group f
4543
*/
4644
public function overridden_relationships()
4745
{

0 commit comments

Comments
 (0)