Skip to content

Commit 2377fa7

Browse files
committed
Merge remote-tracking branch 'upstream/8.x' into 8.x
2 parents 8f48242 + b3ef465 commit 2377fa7

File tree

132 files changed

+1228
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1228
-392
lines changed

.github/workflows/tests.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
matrix:
3434
php: ['7.3', '7.4', '8.0']
3535
stability: [prefer-lowest, prefer-stable]
36+
include:
37+
- php: '8.1'
38+
flags: "--ignore-platform-req=php"
39+
stability: prefer-stable
40+
3641

3742
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
3843

@@ -61,9 +66,10 @@ jobs:
6166
with:
6267
timeout_minutes: 5
6368
max_attempts: 5
64-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
69+
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
6570

6671
- name: Execute tests
72+
continue-on-error: ${{ matrix.php > 8 }}
6773
run: vendor/bin/phpunit --verbose
6874
env:
6975
DB_PORT: ${{ job.services.mysql.ports[3306] }}
@@ -77,6 +83,10 @@ jobs:
7783
matrix:
7884
php: ['7.3', '7.4', '8.0']
7985
stability: [prefer-lowest, prefer-stable]
86+
include:
87+
- php: '8.1'
88+
flags: "--ignore-platform-req=php"
89+
stability: prefer-stable
8090

8191
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows
8292

@@ -110,7 +120,8 @@ jobs:
110120
with:
111121
timeout_minutes: 5
112122
max_attempts: 5
113-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
123+
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}
114124

115125
- name: Execute tests
126+
continue-on-error: ${{ matrix.php > 8 }}
116127
run: vendor/bin/phpunit --verbose

CHANGELOG-6.x.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Release Notes for 6.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.18...6.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.19...6.x)
4+
5+
6+
## [v6.20.19 (2021-03-16)](https://github.com/laravel/framework/compare/v6.20.18...v6.20.19)
7+
8+
### Added
9+
- Added broken pipe exception as lost connection error ([#36601](https://github.com/laravel/framework/pull/36601))
410

511

612
## [v6.20.18 (2021-03-09)](https://github.com/laravel/framework/compare/v6.20.17...v6.20.18)

src/Illuminate/Collections/LazyCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ public function chunkWhile(callable $callback)
10711071
return new static(function () use ($callback) {
10721072
$iterator = $this->getIterator();
10731073

1074-
$chunk = new Collection();
1074+
$chunk = new Collection;
10751075

10761076
if ($iterator->valid()) {
10771077
$chunk[$iterator->key()] = $iterator->current();
@@ -1083,7 +1083,7 @@ public function chunkWhile(callable $callback)
10831083
if (! $callback($iterator->current(), $iterator->key(), $chunk)) {
10841084
yield new static($chunk);
10851085

1086-
$chunk = new Collection();
1086+
$chunk = new Collection;
10871087
}
10881088

10891089
$chunk[$iterator->key()] = $iterator->current();

src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function handle()
5151

5252
if (! empty($output)) {
5353
if ($key !== $keyOfLastExecutionWithOutput) {
54-
$this->info(PHP_EOL.'Execution #'.($key + 1).' output:');
54+
$this->info(PHP_EOL.'['.date('c').'] Execution #'.($key + 1).' output:');
5555

5656
$keyOfLastExecutionWithOutput = $key;
5757
}

src/Illuminate/Container/Container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,9 @@ public function build($concrete)
842842
return $this->notInstantiable($concrete);
843843
}
844844

845-
if (in_array($concrete, $this->buildStack)) {
846-
throw new CircularDependencyException("Circular dependency detected while resolving [{$concrete}].");
847-
}
845+
// if (in_array($concrete, $this->buildStack)) {
846+
// throw new CircularDependencyException("Circular dependency detected while resolving [{$concrete}].");
847+
// }
848848

849849
$this->buildStack[] = $concrete;
850850

src/Illuminate/Database/Concerns/BuildsQueries.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Illuminate\Pagination\LengthAwarePaginator;
99
use Illuminate\Pagination\Paginator;
1010
use Illuminate\Support\Collection;
11+
use Illuminate\Support\LazyCollection;
12+
use InvalidArgumentException;
1113

1214
trait BuildsQueries
1315
{
@@ -159,6 +161,76 @@ public function eachById(callable $callback, $count = 1000, $column = null, $ali
159161
}, $column, $alias);
160162
}
161163

164+
/**
165+
* Query lazily, by chunks of the given size.
166+
*
167+
* @param int $chunkSize
168+
* @return \Illuminate\Support\LazyCollection
169+
*/
170+
public function lazy($chunkSize = 1000)
171+
{
172+
if ($chunkSize < 1) {
173+
throw new InvalidArgumentException('The chunk size should be at least 1');
174+
}
175+
176+
$this->enforceOrderBy();
177+
178+
return LazyCollection::make(function () use ($chunkSize) {
179+
$page = 1;
180+
181+
while (true) {
182+
$results = $this->forPage($page++, $chunkSize)->get();
183+
184+
foreach ($results as $result) {
185+
yield $result;
186+
}
187+
188+
if ($results->count() < $chunkSize) {
189+
return;
190+
}
191+
}
192+
});
193+
}
194+
195+
/**
196+
* Query lazily, by chunking the results of a query by comparing IDs.
197+
*
198+
* @param int $count
199+
* @param string|null $column
200+
* @param string|null $alias
201+
* @return \Illuminate\Support\LazyCollection
202+
*/
203+
public function lazyById($chunkSize = 1000, $column = null, $alias = null)
204+
{
205+
if ($chunkSize < 1) {
206+
throw new InvalidArgumentException('The chunk size should be at least 1');
207+
}
208+
209+
$column = $column ?? $this->defaultKeyName();
210+
211+
$alias = $alias ?? $column;
212+
213+
return LazyCollection::make(function () use ($chunkSize, $column, $alias) {
214+
$lastId = null;
215+
216+
while (true) {
217+
$clone = clone $this;
218+
219+
$results = $clone->forPageAfterId($chunkSize, $lastId, $column)->get();
220+
221+
foreach ($results as $result) {
222+
yield $result;
223+
}
224+
225+
if ($results->count() < $chunkSize) {
226+
return;
227+
}
228+
229+
$lastId = $results->last()->{$alias};
230+
}
231+
});
232+
}
233+
162234
/**
163235
* Execute the query and get the first result.
164236
*

src/Illuminate/Database/DetectsLostConnections.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ protected function causedByLostConnection(Throwable $e)
5151
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
5252
'Temporary failure in name resolution',
5353
'SSL: Broken pipe',
54+
'SQLSTATE[08S01]: Communication link failure',
5455
]);
5556
}
5657
}

src/Illuminate/Database/Eloquent/Relations/MorphPivot.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ public function delete()
7474
});
7575
}
7676

77+
/**
78+
* Get the morph type for the pivot.
79+
*
80+
* @return string
81+
*/
82+
public function getMorphType()
83+
{
84+
return $this->morphType;
85+
}
86+
7787
/**
7888
* Set the morph type for the pivot.
7989
*

src/Illuminate/Database/Schema/MySqlSchemaState.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ protected function executeDumpProcess(Process $process, $output, array $variable
149149
), $output, $variables);
150150
}
151151

152+
if (Str::contains($e->getMessage(), ['set-gtid-purged'])) {
153+
return $this->executeDumpProcess(Process::fromShellCommandLine(
154+
str_replace(' --set-gtid-purged=OFF', '', $process->getCommandLine())
155+
), $output, $variables);
156+
}
157+
152158
throw $e;
153159
}
154160

src/Illuminate/Filesystem/LockableFile.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\Filesystem;
44

5+
use Exception;
56
use Illuminate\Contracts\Filesystem\LockTimeoutException;
67

78
class LockableFile
@@ -65,6 +66,10 @@ protected function ensureDirectoryExists($path)
6566
protected function createResource($path, $mode)
6667
{
6768
$this->handle = @fopen($path, $mode);
69+
70+
if (! $this->handle) {
71+
throw new Exception('Unable to create lockable file: '.$path.'. Please ensure you have permission to create files in this location.');
72+
}
6873
}
6974

7075
/**

0 commit comments

Comments
 (0)