Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/8.x' into 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlindaruk committed Mar 23, 2021
2 parents 8f48242 + b3ef465 commit 2377fa7
Show file tree
Hide file tree
Showing 132 changed files with 1,228 additions and 392 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
matrix:
php: ['7.3', '7.4', '8.0']
stability: [prefer-lowest, prefer-stable]
include:
- php: '8.1'
flags: "--ignore-platform-req=php"
stability: prefer-stable


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

Expand Down Expand Up @@ -61,9 +66,10 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}

- name: Execute tests
continue-on-error: ${{ matrix.php > 8 }}
run: vendor/bin/phpunit --verbose
env:
DB_PORT: ${{ job.services.mysql.ports[3306] }}
Expand All @@ -77,6 +83,10 @@ jobs:
matrix:
php: ['7.3', '7.4', '8.0']
stability: [prefer-lowest, prefer-stable]
include:
- php: '8.1'
flags: "--ignore-platform-req=php"
stability: prefer-stable

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

Expand Down Expand Up @@ -110,7 +120,8 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress ${{ matrix.flags }}

- name: Execute tests
continue-on-error: ${{ matrix.php > 8 }}
run: vendor/bin/phpunit --verbose
8 changes: 7 additions & 1 deletion CHANGELOG-6.x.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Release Notes for 6.x

## [Unreleased](https://github.com/laravel/framework/compare/v6.20.18...6.x)
## [Unreleased](https://github.com/laravel/framework/compare/v6.20.19...6.x)


## [v6.20.19 (2021-03-16)](https://github.com/laravel/framework/compare/v6.20.18...v6.20.19)

### Added
- Added broken pipe exception as lost connection error ([#36601](https://github.com/laravel/framework/pull/36601))


## [v6.20.18 (2021-03-09)](https://github.com/laravel/framework/compare/v6.20.17...v6.20.18)
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ public function chunkWhile(callable $callback)
return new static(function () use ($callback) {
$iterator = $this->getIterator();

$chunk = new Collection();
$chunk = new Collection;

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

$chunk = new Collection();
$chunk = new Collection;
}

$chunk[$iterator->key()] = $iterator->current();
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/Scheduling/ScheduleWorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handle()

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

$keyOfLastExecutionWithOutput = $key;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,9 @@ public function build($concrete)
return $this->notInstantiable($concrete);
}

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

$this->buildStack[] = $concrete;

Expand Down
72 changes: 72 additions & 0 deletions src/Illuminate/Database/Concerns/BuildsQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use InvalidArgumentException;

trait BuildsQueries
{
Expand Down Expand Up @@ -159,6 +161,76 @@ public function eachById(callable $callback, $count = 1000, $column = null, $ali
}, $column, $alias);
}

/**
* Query lazily, by chunks of the given size.
*
* @param int $chunkSize
* @return \Illuminate\Support\LazyCollection
*/
public function lazy($chunkSize = 1000)
{
if ($chunkSize < 1) {
throw new InvalidArgumentException('The chunk size should be at least 1');
}

$this->enforceOrderBy();

return LazyCollection::make(function () use ($chunkSize) {
$page = 1;

while (true) {
$results = $this->forPage($page++, $chunkSize)->get();

foreach ($results as $result) {
yield $result;
}

if ($results->count() < $chunkSize) {
return;
}
}
});
}

/**
* Query lazily, by chunking the results of a query by comparing IDs.
*
* @param int $count
* @param string|null $column
* @param string|null $alias
* @return \Illuminate\Support\LazyCollection
*/
public function lazyById($chunkSize = 1000, $column = null, $alias = null)
{
if ($chunkSize < 1) {
throw new InvalidArgumentException('The chunk size should be at least 1');
}

$column = $column ?? $this->defaultKeyName();

$alias = $alias ?? $column;

return LazyCollection::make(function () use ($chunkSize, $column, $alias) {
$lastId = null;

while (true) {
$clone = clone $this;

$results = $clone->forPageAfterId($chunkSize, $lastId, $column)->get();

foreach ($results as $result) {
yield $result;
}

if ($results->count() < $chunkSize) {
return;
}

$lastId = $results->last()->{$alias};
}
});
}

/**
* Execute the query and get the first result.
*
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Database/DetectsLostConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected function causedByLostConnection(Throwable $e)
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
'Temporary failure in name resolution',
'SSL: Broken pipe',
'SQLSTATE[08S01]: Communication link failure',
]);
}
}
10 changes: 10 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/MorphPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ public function delete()
});
}

/**
* Get the morph type for the pivot.
*
* @return string
*/
public function getMorphType()
{
return $this->morphType;
}

/**
* Set the morph type for the pivot.
*
Expand Down
6 changes: 6 additions & 0 deletions src/Illuminate/Database/Schema/MySqlSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ protected function executeDumpProcess(Process $process, $output, array $variable
), $output, $variables);
}

if (Str::contains($e->getMessage(), ['set-gtid-purged'])) {
return $this->executeDumpProcess(Process::fromShellCommandLine(
str_replace(' --set-gtid-purged=OFF', '', $process->getCommandLine())
), $output, $variables);
}

throw $e;
}

Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Filesystem/LockableFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Filesystem;

use Exception;
use Illuminate\Contracts\Filesystem\LockTimeoutException;

class LockableFile
Expand Down Expand Up @@ -65,6 +66,10 @@ protected function ensureDirectoryExists($path)
protected function createResource($path, $mode)
{
$this->handle = @fopen($path, $mode);

if (! $this->handle) {
throw new Exception('Unable to create lockable file: '.$path.'. Please ensure you have permission to create files in this location.');
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '8.33.0';
const VERSION = '8.34.0';

/**
* The base path for the Laravel installation.
Expand Down
11 changes: 10 additions & 1 deletion src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ protected function filterRoute(array $route)
return;
}

if ($this->option('except-path')) {
foreach (explode(',', $this->option('except-path')) as $path) {
if (Str::contains($route['uri'], $path)) {
return;
}
}
}

return $route;
}

Expand Down Expand Up @@ -258,7 +266,8 @@ protected function getOptions()
['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'],
['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'],
['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'],
['path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path'],
['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'],
['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'],
['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'],
['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'],
];
Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Foundation/Inspiring.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public static function quote()
'Waste no more time arguing what a good man should be, be one. - Marcus Aurelius',
'Well begun is half done. - Aristotle',
'When there is no desire, all things are at peace. - Laozi',
'Walk as if you are kissing the Earth with your feet. - Thich Nhat Hanh',
'Because you are alive, everything is possible. - Thich Nhat Hanh',
'Breathing in, I calm body and mind. Breathing out, I smile. - Thich Nhat Hanh',
'Life is available only in the present moment. - Thich Nhat Hanh',
'The best way to take care of the future is to take care of the present moment. - Thich Nhat Hanh',
])->random();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ protected function registerEventClearCommand()
protected function registerEventListCommand()
{
$this->app->singleton('command.event.list', function () {
return new EventListCommand();
return new EventListCommand;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Illuminate\Support\Facades\Event;
use Mockery;

/**
* @deprecated Will be removed in a future Laravel version.
*/
trait MocksApplicationServices
{
/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function path()
{
$pattern = trim($this->getPathInfo(), '/');

return $pattern == '' ? '/' : $pattern;
return $pattern === '' ? '/' : $pattern;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Testing/MimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MimeType
public static function getMimeTypes()
{
if (self::$mime === null) {
self::$mime = new MimeTypes();
self::$mime = new MimeTypes;
}

return self::$mime;
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/MailManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ protected function createPostmarkTransport(array $config)
$config['token'] ?? $this->app['config']->get('services.postmark.token'),
$headers
), function ($transport) {
$transport->registerPlugin(new ThrowExceptionOnFailurePlugin());
$transport->registerPlugin(new ThrowExceptionOnFailurePlugin);
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Mail/Markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public function render($view, array $data = [], $inliner = null)
'mail', $this->htmlComponentPaths()
)->make($view, $data)->render();

if ($this->view->exists($this->theme)) {
$theme = $this->theme;
if ($this->view->exists($customTheme = Str::start($this->theme, 'mail.'))) {
$theme = $customTheme;
} else {
$theme = Str::contains($this->theme, '::')
? $this->theme
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Queue/DatabaseQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ protected function getLockForPopping()
$databaseEngine = $this->database->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
$databaseVersion = $this->database->getConfig('version') ?? $this->database->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);

if ($databaseEngine == 'mysql' && ! strpos($databaseVersion, 'MariaDB') && version_compare($databaseVersion, '8.0.1', '>=') ||
$databaseEngine == 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) {
if ($databaseEngine === 'mysql' && ! strpos($databaseVersion, 'MariaDB') && version_compare($databaseVersion, '8.0.1', '>=') ||
$databaseEngine === 'pgsql' && version_compare($databaseVersion, '9.5', '>=')) {
return 'FOR UPDATE SKIP LOCKED';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/Middleware/ThrottlesExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function withPrefix(string $prefix)
}

/**
* Specify the number of seconds a job should be delayed when it is released (before it has reached its max exceptions).
* Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions).
*
* @param int $backoff
* @return $this
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/CompiledRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected function newRoute(array $attributes)
), '/');
}

return $this->router->newRoute($attributes['methods'], $baseUri == '' ? '/' : $baseUri, $attributes['action'])
return $this->router->newRoute($attributes['methods'], $baseUri === '' ? '/' : $baseUri, $attributes['action'])
->setFallback($attributes['fallback'])
->setDefaults($attributes['defaults'])
->setWheres($attributes['wheres'])
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Session/Middleware/StartSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function handle($request, Closure $next)
if ($this->manager->shouldBlock() ||
($request->route() instanceof Route && $request->route()->locksFor())) {
return $this->handleRequestWhileBlocking($request, $session, $next);
} else {
return $this->handleStatefulRequest($request, $session, $next);
}

return $this->handleStatefulRequest($request, $session, $next);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Facades/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @method static bool runningInConsole()
* @method static bool runningUnitTests()
* @method static bool shouldSkipMiddleware()
* @method static string basePath()
* @method static string basePath(string $path = '')
* @method static string bootstrapPath(string $path = '')
* @method static string configPath(string $path = '')
* @method static string databasePath(string $path = '')
Expand Down
Loading

0 comments on commit 2377fa7

Please sign in to comment.