Skip to content

Commit e0d3cd9

Browse files
committed
Merge remote-tracking branch 'upstream/6.x' into 6.x
2 parents cc87d13 + 92c0417 commit e0d3cd9

28 files changed

+194
-92
lines changed

src/Illuminate/Cache/CacheManager.php

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
namespace Illuminate\Cache;
44

5+
use Aws\DynamoDb\DynamoDbClient;
56
use Closure;
67
use Illuminate\Contracts\Cache\Factory as FactoryContract;
78
use Illuminate\Contracts\Cache\Store;
89
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
10+
use Illuminate\Support\Arr;
911
use InvalidArgumentException;
1012

1113
/**
@@ -224,9 +226,11 @@ protected function createDatabaseDriver(array $config)
224226
*/
225227
protected function createDynamodbDriver(array $config)
226228
{
229+
$client = $this->newDynamodbClient($config);
230+
227231
return $this->repository(
228232
new DynamoDbStore(
229-
$this->app['cache.dynamodb.client'],
233+
$client,
230234
$config['table'],
231235
$config['attributes']['key'] ?? 'key',
232236
$config['attributes']['value'] ?? 'value',
@@ -236,6 +240,28 @@ protected function createDynamodbDriver(array $config)
236240
);
237241
}
238242

243+
/**
244+
* Create new DynamoDb Client instance.
245+
*
246+
* @return DynamoDbClient
247+
*/
248+
protected function newDynamodbClient(array $config)
249+
{
250+
$dynamoConfig = [
251+
'region' => $config['region'],
252+
'version' => 'latest',
253+
'endpoint' => $config['endpoint'] ?? null,
254+
];
255+
256+
if (isset($config['key']) && isset($config['secret'])) {
257+
$dynamoConfig['credentials'] = Arr::only(
258+
$config, ['key', 'secret', 'token']
259+
);
260+
}
261+
262+
return new DynamoDbClient($dynamoConfig);
263+
}
264+
239265
/**
240266
* Create a new cache repository with the given implementation.
241267
*

src/Illuminate/Cache/CacheServiceProvider.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace Illuminate\Cache;
44

5-
use Aws\DynamoDb\DynamoDbClient;
65
use Illuminate\Contracts\Support\DeferrableProvider;
7-
use Illuminate\Support\Arr;
86
use Illuminate\Support\ServiceProvider;
97
use Symfony\Component\Cache\Adapter\Psr16Adapter;
108

@@ -32,24 +30,6 @@ public function register()
3230
$this->app->singleton('memcached.connector', function () {
3331
return new MemcachedConnector;
3432
});
35-
36-
$this->app->singleton('cache.dynamodb.client', function ($app) {
37-
$config = $app['config']->get('cache.stores.dynamodb');
38-
39-
$dynamoConfig = [
40-
'region' => $config['region'],
41-
'version' => 'latest',
42-
'endpoint' => $config['endpoint'] ?? null,
43-
];
44-
45-
if ($config['key'] && $config['secret']) {
46-
$dynamoConfig['credentials'] = Arr::only(
47-
$config, ['key', 'secret', 'token']
48-
);
49-
}
50-
51-
return new DynamoDbClient($dynamoConfig);
52-
});
5333
}
5434

5535
/**
@@ -60,7 +40,7 @@ public function register()
6040
public function provides()
6141
{
6242
return [
63-
'cache', 'cache.store', 'cache.psr6', 'memcached.connector', 'cache.dynamodb.client',
43+
'cache', 'cache.store', 'cache.psr6', 'memcached.connector',
6444
];
6545
}
6646
}

src/Illuminate/Cache/DynamoDbStore.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,4 +525,14 @@ public function setPrefix($prefix)
525525
{
526526
$this->prefix = ! empty($prefix) ? $prefix.':' : '';
527527
}
528+
529+
/**
530+
* Get the DynamoDb Client instance.
531+
*
532+
* @return DynamoDbClient
533+
*/
534+
public function getClient()
535+
{
536+
return $this->dynamo;
537+
}
528538
}

src/Illuminate/Database/Query/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1932,7 +1932,7 @@ public function offset($value)
19321932
{
19331933
$property = $this->unions ? 'unionOffset' : 'offset';
19341934

1935-
$this->$property = max(0, $value);
1935+
$this->$property = max(0, (int) $value);
19361936

19371937
return $this;
19381938
}

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ protected function compileColumns(Builder $query, $columns)
6060
// If there is a limit on the query, but not an offset, we will add the top
6161
// clause to the query, which serves as a "limit" type clause within the
6262
// SQL Server system similar to the limit keywords available in MySQL.
63-
if ($query->limit > 0 && $query->offset <= 0) {
64-
$select .= 'top '.$query->limit.' ';
63+
if (is_numeric($query->limit) && $query->limit > 0 && $query->offset <= 0) {
64+
$select .= 'top '.((int) $query->limit).' ';
6565
}
6666

6767
return $select.$this->columnize($columns);
@@ -221,10 +221,10 @@ protected function compileTableExpression($sql, $query)
221221
*/
222222
protected function compileRowConstraint($query)
223223
{
224-
$start = $query->offset + 1;
224+
$start = (int) $query->offset + 1;
225225

226226
if ($query->limit > 0) {
227-
$finish = $query->offset + $query->limit;
227+
$finish = (int) $query->offset + (int) $query->limit;
228228

229229
return "between {$start} and {$finish}";
230230
}

src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class SqlServerGrammar extends Grammar
2929
protected $serials = ['tinyInteger', 'smallInteger', 'mediumInteger', 'integer', 'bigInteger'];
3030

3131
/**
32-
* Compile the query to determine if a table exists.
32+
* Compile the query to determine if a table or view exists.
3333
*
3434
* @return string
3535
*/
3636
public function compileTableExists()
3737
{
38-
return "select * from sysobjects where type = 'U' and name = ?";
38+
return "select * from sysobjects where type in ('U', 'V') and name = ?";
3939
}
4040

4141
/**
@@ -48,7 +48,7 @@ public function compileColumnListing($table)
4848
{
4949
return "select col.name from sys.columns as col
5050
join sys.objects as obj on col.object_id = obj.object_id
51-
where obj.type = 'U' and obj.name = '$table'";
51+
where obj.type in ('U', 'V') and obj.name = '$table'";
5252
}
5353

5454
/**

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
3131
*
3232
* @var string
3333
*/
34-
const VERSION = '6.20.25';
34+
const VERSION = '6.20.27';
3535

3636
/**
3737
* The base path for the Laravel installation.

src/Illuminate/Foundation/Exceptions/Handler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ public function report(Exception $e)
105105
}
106106

107107
if (Reflector::isCallable($reportCallable = [$e, 'report'])) {
108-
return $this->container->call($reportCallable);
108+
if (($response = $this->container->call($reportCallable)) !== false) {
109+
return $response;
110+
}
109111
}
110112

111113
try {

src/Illuminate/Foundation/Testing/Concerns/InteractsWithExceptionHandling.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ protected function withoutExceptionHandling(array $except = [])
6464
$this->originalExceptionHandler = app(ExceptionHandler::class);
6565
}
6666

67-
$this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler {
67+
$this->app->instance(ExceptionHandler::class, new class($this->originalExceptionHandler, $except) implements ExceptionHandler
68+
{
6869
protected $except;
6970
protected $originalHandler;
7071

src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public function withoutMiddleware($middleware = null)
121121
}
122122

123123
foreach ((array) $middleware as $abstract) {
124-
$this->app->instance($abstract, new class {
124+
$this->app->instance($abstract, new class
125+
{
125126
public function handle($request, $next)
126127
{
127128
return $next($request);

0 commit comments

Comments
 (0)