Skip to content

Commit bdf5725

Browse files
committed
Merge branch '9.x'
# Conflicts: # .github/workflows/tests.yml # CHANGELOG.md # composer.json # src/Illuminate/Console/composer.json # src/Illuminate/Database/composer.json # src/Illuminate/Foundation/Application.php # src/Illuminate/Mail/composer.json # src/Illuminate/Queue/composer.json # src/Illuminate/Redis/composer.json # src/Illuminate/Support/Stringable.php # src/Illuminate/Support/composer.json # src/Illuminate/Testing/composer.json # src/Illuminate/Validation/composer.json # tests/Routing/ImplicitRouteBindingTest.php
2 parents 3f9345d + 470f0da commit bdf5725

File tree

200 files changed

+9544
-798
lines changed

Some content is hidden

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

200 files changed

+9544
-798
lines changed

.github/workflows/tests.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ jobs:
3939
strategy:
4040
fail-fast: true
4141
matrix:
42-
php: [8.1]
42+
php: [8.1, 8.2]
4343
stability: [prefer-lowest, prefer-stable]
44-
include:
45-
- php: 8.2
46-
stability: prefer-stable --ignore-platform-req=php+
4744

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

@@ -55,7 +52,7 @@ jobs:
5552
uses: shivammathur/setup-php@v2
5653
with:
5754
php-version: ${{ matrix.php }}
58-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis-phpredis/[email protected].5, igbinary, msgpack, lzf, zstd, lz4, memcached, gmp
55+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis-phpredis/[email protected].7, igbinary, msgpack, lzf, zstd, lz4, memcached, gmp
5956
ini-values: error_reporting=E_ALL
6057
tools: composer:v2
6158
coverage: none
@@ -71,6 +68,14 @@ jobs:
7168
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update
7269
if: matrix.php >= 8.1
7370

71+
- name: Set Minimum PHP 8.2 Versions
72+
uses: nick-invision/retry@v1
73+
with:
74+
timeout_minutes: 5
75+
max_attempts: 5
76+
command: composer require guzzlehttp/guzzle:^7.5 guzzlehttp/psr7:^2.4 predis/predis:^2.0.2 --no-interaction --no-update
77+
if: matrix.php >= 8.2
78+
7479
- name: Install dependencies
7580
uses: nick-invision/retry@v1
7681
with:
@@ -102,11 +107,8 @@ jobs:
102107
strategy:
103108
fail-fast: true
104109
matrix:
105-
php: [8.1]
110+
php: [8.1, 8.2]
106111
stability: [prefer-lowest, prefer-stable]
107-
include:
108-
- php: 8.2
109-
stability: prefer-stable --ignore-platform-req=php+
110112

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

@@ -127,6 +129,22 @@ jobs:
127129
tools: composer:v2
128130
coverage: none
129131

132+
- name: Set Minimum PHP 8.1 Versions
133+
uses: nick-invision/retry@v1
134+
with:
135+
timeout_minutes: 5
136+
max_attempts: 5
137+
command: composer require ramsey/collection:^1.2 brick/math:^0.9.3 --no-interaction --no-update
138+
if: matrix.php >= 8.1
139+
140+
- name: Set Minimum PHP 8.2 Versions
141+
uses: nick-invision/retry@v1
142+
with:
143+
timeout_minutes: 5
144+
max_attempts: 5
145+
command: composer require guzzlehttp/guzzle:~7.5 guzzlehttp/psr7:~2.4 predis/predis:^2.0.2 --no-interaction --no-update
146+
if: matrix.php >= 8.2
147+
130148
- name: Install dependencies
131149
uses: nick-invision/retry@v1
132150
with:

composer.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"ext-mbstring": "*",
2020
"ext-openssl": "*",
2121
"doctrine/inflector": "^2.0",
22-
"dragonmantank/cron-expression": "^3.1",
23-
"egulias/email-validator": "^3.1",
22+
"dragonmantank/cron-expression": "^3.3.2",
23+
"egulias/email-validator": "^3.2.1",
2424
"fruitcake/php-cors": "^1.2",
25-
"laravel/serializable-closure": "^1.0",
25+
"laravel/serializable-closure": "^1.2.2",
2626
"league/commonmark": "^2.2",
27-
"league/flysystem": "^3.0.16",
27+
"league/flysystem": "^3.8.0",
2828
"monolog/monolog": "^3.0",
29-
"nesbot/carbon": "^2.53.1",
29+
"nesbot/carbon": "^2.62.1",
3030
"nunomaduro/termwind": "^1.13",
3131
"psr/container": "^1.1.1|^2.0.1",
3232
"psr/log": "^1.0|^2.0|^3.0",
@@ -43,7 +43,7 @@
4343
"symfony/routing": "^6.2",
4444
"symfony/uid": "^6.2",
4545
"symfony/var-dumper": "^6.2",
46-
"tijsverkoyen/css-to-inline-styles": "^2.2.2",
46+
"tijsverkoyen/css-to-inline-styles": "^2.2.5",
4747
"vlucas/phpdotenv": "^5.4.1",
4848
"voku/portable-ascii": "^2.0"
4949
},
@@ -83,21 +83,21 @@
8383
},
8484
"require-dev": {
8585
"ably/ably-php": "^1.0",
86-
"aws/aws-sdk-php": "^3.198.1",
86+
"aws/aws-sdk-php": "^3.235.5",
8787
"doctrine/dbal": "^2.13.3|^3.1.4",
8888
"fakerphp/faker": "^1.9.2",
89-
"guzzlehttp/guzzle": "^7.2",
89+
"guzzlehttp/guzzle": "^7.5",
9090
"league/flysystem-aws-s3-v3": "^3.0",
9191
"league/flysystem-ftp": "^3.0",
9292
"league/flysystem-path-prefixing": "^3.3",
9393
"league/flysystem-read-only": "^3.3",
9494
"league/flysystem-sftp-v3": "^3.0",
95-
"mockery/mockery": "^1.4.4",
95+
"mockery/mockery": "^1.5.1",
9696
"orchestra/testbench-core": "^8.0",
9797
"pda/pheanstalk": "^4.0",
9898
"phpstan/phpstan": "^1.4.7",
9999
"phpunit/phpunit": "^9.5.8",
100-
"predis/predis": "^2.0",
100+
"predis/predis": "^2.0.2",
101101
"symfony/cache": "^6.2"
102102
},
103103
"provide": {
@@ -145,23 +145,23 @@
145145
"ext-posix": "Required to use all features of the queue worker.",
146146
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
147147
"ably/ably-php": "Required to use the Ably broadcast driver (^1.0).",
148-
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.198.1).",
148+
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).",
149149
"brianium/paratest": "Required to run tests in parallel (^6.0).",
150150
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).",
151151
"fakerphp/faker": "Required to use the eloquent factory builder (^1.9.1).",
152152
"filp/whoops": "Required for friendly error pages in development (^2.14.3).",
153-
"guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.2).",
153+
"guzzlehttp/guzzle": "Required to use the HTTP Client and the ping methods on schedules (^7.5).",
154154
"laravel/tinker": "Required to use the tinker console command (^2.0).",
155155
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).",
156156
"league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).",
157157
"league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).",
158158
"league/flysystem-read-only": "Required to use read-only disks (^3.3)",
159159
"league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).",
160-
"mockery/mockery": "Required to use mocking (^1.4.4).",
160+
"mockery/mockery": "Required to use mocking (^1.5.1).",
161161
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
162162
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
163163
"phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).",
164-
"predis/predis": "Required to use the predis connector (^2.0).",
164+
"predis/predis": "Required to use the predis connector (^2.0.2).",
165165
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
166166
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
167167
"symfony/cache": "Required to PSR-6 cache bridge (^6.2).",

src/Illuminate/Auth/AuthManager.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ public function createSessionDriver($name, $config)
120120
{
121121
$provider = $this->createUserProvider($config['provider'] ?? null);
122122

123-
$guard = new SessionGuard($name, $provider, $this->app['session.store']);
123+
$guard = new SessionGuard(
124+
$name,
125+
$provider,
126+
$this->app['session.store'],
127+
);
124128

125129
// When using the remember me functionality of the authentication services we
126130
// will need to be set the encryption instance of the guard, which allows

src/Illuminate/Auth/EloquentUserProvider.php

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ class EloquentUserProvider implements UserProvider
2424
*/
2525
protected $model;
2626

27+
/**
28+
* The callback that may modify the user retrieval queries.
29+
*
30+
* @var (\Closure(\Illuminate\Database\Eloquent\Builder):mixed)|null
31+
*/
32+
protected $queryCallback;
33+
2734
/**
2835
* Create a new database user provider.
2936
*
@@ -155,9 +162,13 @@ public function validateCredentials(UserContract $user, array $credentials)
155162
*/
156163
protected function newModelQuery($model = null)
157164
{
158-
return is_null($model)
165+
$query = is_null($model)
159166
? $this->createModel()->newQuery()
160167
: $model->newQuery();
168+
169+
with($query, $this->queryCallback);
170+
171+
return $query;
161172
}
162173

163174
/**
@@ -217,4 +228,27 @@ public function setModel($model)
217228

218229
return $this;
219230
}
231+
232+
/**
233+
* Get the callback that modifies the query before retrieving users.
234+
*
235+
* @return \Closure|null
236+
*/
237+
public function getQueryCallback()
238+
{
239+
return $this->queryCallback;
240+
}
241+
242+
/**
243+
* Sets the callback to modify the query before retrieving users.
244+
*
245+
* @param (\Closure(\Illuminate\Database\Eloquent\Builder):mixed)|null $queryCallback
246+
* @return $this
247+
*/
248+
public function withQuery($queryCallback = null)
249+
{
250+
$this->queryCallback = $queryCallback;
251+
252+
return $this;
253+
}
220254
}

src/Illuminate/Auth/SessionGuard.php

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Illuminate\Support\Arr;
2121
use Illuminate\Support\Facades\Hash;
2222
use Illuminate\Support\Str;
23+
use Illuminate\Support\Timebox;
2324
use Illuminate\Support\Traits\Macroable;
2425
use InvalidArgumentException;
2526
use RuntimeException;
@@ -88,6 +89,13 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
8889
*/
8990
protected $events;
9091

92+
/**
93+
* The timebox instance.
94+
*
95+
* @var \Illuminate\Support\Timebox
96+
*/
97+
protected $timebox;
98+
9199
/**
92100
* Indicates if the logout method has been called.
93101
*
@@ -109,17 +117,20 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
109117
* @param \Illuminate\Contracts\Auth\UserProvider $provider
110118
* @param \Illuminate\Contracts\Session\Session $session
111119
* @param \Symfony\Component\HttpFoundation\Request|null $request
120+
* @param \Illuminate\Support\Timebox|null $timebox
112121
* @return void
113122
*/
114123
public function __construct($name,
115124
UserProvider $provider,
116125
Session $session,
117-
Request $request = null)
126+
Request $request = null,
127+
Timebox $timebox = null)
118128
{
119129
$this->name = $name;
120130
$this->session = $session;
121131
$this->request = $request;
122132
$this->provider = $provider;
133+
$this->timebox = $timebox ?: new Timebox;
123134
}
124135

125136
/**
@@ -423,13 +434,17 @@ public function attemptWhen(array $credentials = [], $callbacks = null, $remembe
423434
*/
424435
protected function hasValidCredentials($user, $credentials)
425436
{
426-
$validated = ! is_null($user) && $this->provider->validateCredentials($user, $credentials);
437+
return $this->timebox->call(function ($timebox) use ($user, $credentials) {
438+
$validated = ! is_null($user) && $this->provider->validateCredentials($user, $credentials);
427439

428-
if ($validated) {
429-
$this->fireValidatedEvent($user);
430-
}
440+
if ($validated) {
441+
$timebox->returnEarly();
442+
443+
$this->fireValidatedEvent($user);
444+
}
431445

432-
return $validated;
446+
return $validated;
447+
}, 200 * 1000);
433448
}
434449

435450
/**
@@ -929,4 +944,14 @@ public function setRequest(Request $request)
929944

930945
return $this;
931946
}
947+
948+
/**
949+
* Get the timebox instance used by the guard.
950+
*
951+
* @return \Illuminate\Support\Timebox
952+
*/
953+
public function getTimebox()
954+
{
955+
return $this->timebox;
956+
}
932957
}

src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Illuminate\Contracts\Routing\UrlRoutable;
1212
use Illuminate\Support\Arr;
1313
use Illuminate\Support\Reflector;
14-
use Illuminate\Support\Str;
1514
use ReflectionClass;
1615
use ReflectionFunction;
1716
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -117,7 +116,11 @@ protected function verifyUserCanAccessChannel($request, $channel)
117116

118117
$handler = $this->normalizeChannelHandlerToCallable($callback);
119118

120-
if ($result = $handler($this->retrieveUser($request, $channel), ...$parameters)) {
119+
$result = $handler($this->retrieveUser($request, $channel), ...$parameters);
120+
121+
if ($result === false) {
122+
throw new AccessDeniedHttpException;
123+
} elseif ($result) {
121124
return $this->validAuthenticationResponse($request, $result);
122125
}
123126
}
@@ -368,6 +371,6 @@ protected function retrieveChannelOptions($channel)
368371
*/
369372
protected function channelNameMatchesPattern($channel, $pattern)
370373
{
371-
return Str::is(preg_replace('/\{(.*?)\}/', '*', $pattern), $channel);
374+
return preg_match('/'.preg_replace('/\{(.*?)\}/', '([^\.]+)', $pattern).'$/', $channel);
372375
}
373376
}

src/Illuminate/Collections/Traits/EnumeratesValues.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,12 @@ protected function getArrayableItems($items)
995995
return $items->all();
996996
} elseif ($items instanceof Arrayable) {
997997
return $items->toArray();
998+
} elseif ($items instanceof Traversable) {
999+
return iterator_to_array($items);
9981000
} elseif ($items instanceof Jsonable) {
9991001
return json_decode($items->toJson(), true);
10001002
} elseif ($items instanceof JsonSerializable) {
10011003
return (array) $items->jsonSerialize();
1002-
} elseif ($items instanceof Traversable) {
1003-
return iterator_to_array($items);
10041004
} elseif ($items instanceof UnitEnum) {
10051005
return [$items];
10061006
}

src/Illuminate/Console/Concerns/InteractsWithIO.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,17 +364,18 @@ public function warn($string, $verbosity = null)
364364
* Write a string in an alert box.
365365
*
366366
* @param string $string
367+
* @param int|string|null $verbosity
367368
* @return void
368369
*/
369-
public function alert($string)
370+
public function alert($string, $verbosity = null)
370371
{
371372
$length = Str::length(strip_tags($string)) + 12;
372373

373-
$this->comment(str_repeat('*', $length));
374-
$this->comment('* '.$string.' *');
375-
$this->comment(str_repeat('*', $length));
374+
$this->comment(str_repeat('*', $length), $verbosity);
375+
$this->comment('* '.$string.' *', $verbosity);
376+
$this->comment(str_repeat('*', $length), $verbosity);
376377

377-
$this->newLine();
378+
$this->comment('', $verbosity);
378379
}
379380

380381
/**

src/Illuminate/Console/GeneratorCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function handle()
182182
}
183183
}
184184

185-
$this->components->info($info.' created successfully.');
185+
$this->components->info(sprintf('%s [%s] created successfully.', $info, $path));
186186
}
187187

188188
/**

0 commit comments

Comments
 (0)