Skip to content

Commit 8a69a6e

Browse files
committed
Merge tag 'v12.25.0'
Signed-off-by: Mior Muhammad Zaki <[email protected]>
2 parents f4f9156 + 2ee2ba9 commit 8a69a6e

File tree

293 files changed

+6950
-1101
lines changed

Some content is hidden

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

293 files changed

+6950
-1101
lines changed

CHANGELOG.md

Lines changed: 140 additions & 1 deletion
Large diffs are not rendered by default.

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
"symfony/mailer": "^7.4.0|^8.0.0",
5353
"symfony/mime": "^7.4.0|^8.0.0",
5454
"symfony/process": "^7.4.0|^8.0.0",
55+
"symfony/polyfill-php84": "^1.31",
56+
"symfony/polyfill-php85": "^1.31",
5557
"symfony/routing": "^7.4.0|^8.0.0",
5658
"symfony/uid": "^7.4.0|^8.0.0",
5759
"symfony/var-dumper": "^7.4.0|^8.0.0",

src/Illuminate/Auth/Access/Gate.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public function after(callable $callback)
326326
* Determine if all of the given abilities should be granted for the current user.
327327
*
328328
* @param iterable|\UnitEnum|string $ability
329-
* @param array|mixed $arguments
329+
* @param mixed $arguments
330330
* @return bool
331331
*/
332332
public function allows($ability, $arguments = [])
@@ -338,7 +338,7 @@ public function allows($ability, $arguments = [])
338338
* Determine if any of the given abilities should be denied for the current user.
339339
*
340340
* @param iterable|\UnitEnum|string $ability
341-
* @param array|mixed $arguments
341+
* @param mixed $arguments
342342
* @return bool
343343
*/
344344
public function denies($ability, $arguments = [])
@@ -350,7 +350,7 @@ public function denies($ability, $arguments = [])
350350
* Determine if all of the given abilities should be granted for the current user.
351351
*
352352
* @param iterable|\UnitEnum|string $abilities
353-
* @param array|mixed $arguments
353+
* @param mixed $arguments
354354
* @return bool
355355
*/
356356
public function check($abilities, $arguments = [])
@@ -364,7 +364,7 @@ public function check($abilities, $arguments = [])
364364
* Determine if any one of the given abilities should be granted for the current user.
365365
*
366366
* @param iterable|\UnitEnum|string $abilities
367-
* @param array|mixed $arguments
367+
* @param mixed $arguments
368368
* @return bool
369369
*/
370370
public function any($abilities, $arguments = [])
@@ -376,7 +376,7 @@ public function any($abilities, $arguments = [])
376376
* Determine if all of the given abilities should be denied for the current user.
377377
*
378378
* @param iterable|\UnitEnum|string $abilities
379-
* @param array|mixed $arguments
379+
* @param mixed $arguments
380380
* @return bool
381381
*/
382382
public function none($abilities, $arguments = [])
@@ -388,7 +388,7 @@ public function none($abilities, $arguments = [])
388388
* Determine if the given ability should be granted for the current user.
389389
*
390390
* @param \UnitEnum|string $ability
391-
* @param array|mixed $arguments
391+
* @param mixed $arguments
392392
* @return \Illuminate\Auth\Access\Response
393393
*
394394
* @throws \Illuminate\Auth\Access\AuthorizationException

src/Illuminate/Auth/Access/HandlesAuthorization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protected function allow($message = null, $code = null)
2020
* Throws an unauthorized exception.
2121
*
2222
* @param string|null $message
23-
* @param mixed|null $code
23+
* @param mixed $code
2424
* @return \Illuminate\Auth\Access\Response
2525
*/
2626
protected function deny($message = null, $code = null)

src/Illuminate/Auth/Middleware/RequirePassword.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Illuminate\Contracts\Routing\ResponseFactory;
77
use Illuminate\Contracts\Routing\UrlGenerator;
8+
use Illuminate\Support\Facades\Date;
89

910
class RequirePassword
1011
{
@@ -92,7 +93,7 @@ public function handle($request, Closure $next, $redirectToRoute = null, $passwo
9293
*/
9394
protected function shouldConfirmPassword($request, $passwordTimeoutSeconds = null)
9495
{
95-
$confirmedAt = time() - $request->session()->get('auth.password_confirmed_at', 0);
96+
$confirmedAt = Date::now()->unix() - $request->session()->get('auth.password_confirmed_at', 0);
9697

9798
return $confirmedAt > ($passwordTimeoutSeconds ?? $this->passwordTimeout);
9899
}

src/Illuminate/Auth/Notifications/VerifyEmail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class VerifyEmail extends Notification
2121
/**
2222
* The callback that should be used to build the mail message.
2323
*
24-
* @var \Closure|null
24+
* @var (\Closure(mixed, string): \Illuminate\Notifications\Messages\MailMessage|\Illuminate\Contracts\Mail\Mailable)|null
2525
*/
2626
public static $toMailCallback;
2727

@@ -104,7 +104,7 @@ public static function createUrlUsing($callback)
104104
/**
105105
* Set a callback that should be used when building the notification mail message.
106106
*
107-
* @param \Closure $callback
107+
* @param \Closure(mixed, string): (\Illuminate\Notifications\Messages\MailMessage|\Illuminate\Contracts\Mail\Mailable) $callback
108108
* @return void
109109
*/
110110
public static function toMailUsing($callback)

src/Illuminate/Auth/Passwords/CacheTokenRepository.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public function __construct(
2424
protected string $hashKey,
2525
protected int $expires = 3600,
2626
protected int $throttle = 60,
27-
protected string $prefix = '',
2827
) {
2928
}
3029

@@ -41,7 +40,7 @@ public function create(CanResetPasswordContract $user)
4140
$token = hash_hmac('sha256', Str::random(40), $this->hashKey);
4241

4342
$this->cache->put(
44-
$this->prefix.$user->getEmailForPasswordReset(),
43+
$this->cacheKey($user),
4544
[$this->hasher->make($token), Carbon::now()->format($this->format)],
4645
$this->expires,
4746
);
@@ -58,7 +57,7 @@ public function create(CanResetPasswordContract $user)
5857
*/
5958
public function exists(CanResetPasswordContract $user, #[\SensitiveParameter] $token)
6059
{
61-
[$record, $createdAt] = $this->cache->get($this->prefix.$user->getEmailForPasswordReset());
60+
[$record, $createdAt] = $this->cache->get($this->cacheKey($user));
6261

6362
return $record
6463
&& ! $this->tokenExpired($createdAt)
@@ -84,7 +83,7 @@ protected function tokenExpired($createdAt)
8483
*/
8584
public function recentlyCreatedToken(CanResetPasswordContract $user)
8685
{
87-
[$record, $createdAt] = $this->cache->get($this->prefix.$user->getEmailForPasswordReset());
86+
[$record, $createdAt] = $this->cache->get($this->cacheKey($user));
8887

8988
return $record && $this->tokenRecentlyCreated($createdAt);
9089
}
@@ -114,7 +113,7 @@ protected function tokenRecentlyCreated($createdAt)
114113
*/
115114
public function delete(CanResetPasswordContract $user)
116115
{
117-
$this->cache->forget($this->prefix.$user->getEmailForPasswordReset());
116+
$this->cache->forget($this->cacheKey($user));
118117
}
119118

120119
/**
@@ -125,4 +124,15 @@ public function delete(CanResetPasswordContract $user)
125124
public function deleteExpired()
126125
{
127126
}
127+
128+
/**
129+
* Determine the cache key for the given user.
130+
*
131+
* @param \Illuminate\Contracts\Auth\CanResetPassword $user
132+
* @return string
133+
*/
134+
public function cacheKey(CanResetPasswordContract $user): string
135+
{
136+
return hash('sha256', $user->getEmailForPasswordReset());
137+
}
128138
}

src/Illuminate/Auth/Passwords/PasswordBrokerManager.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ protected function createTokenRepository(array $config)
9595
$key,
9696
($config['expire'] ?? 60) * 60,
9797
$config['throttle'] ?? 0,
98-
$config['prefix'] ?? '',
9998
);
10099
}
101100

src/Illuminate/Broadcasting/Broadcasters/RedisBroadcaster.php

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44

55
use Illuminate\Broadcasting\BroadcastException;
66
use Illuminate\Contracts\Redis\Factory as Redis;
7+
use Illuminate\Redis\Connections\PhpRedisClusterConnection;
8+
use Illuminate\Redis\Connections\PredisClusterConnection;
9+
use Illuminate\Redis\Connections\PredisConnection;
710
use Illuminate\Support\Arr;
11+
use Predis\Connection\Cluster\RedisCluster;
812
use Predis\Connection\ConnectionException;
913
use RedisException;
1014
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -125,10 +129,30 @@ public function broadcast(array $channels, $event, array $payload = [])
125129
]);
126130

127131
try {
128-
$connection->eval(
129-
$this->broadcastMultipleChannelsScript(),
130-
0, $payload, ...$this->formatChannels($channels)
131-
);
132+
if ($connection instanceof PhpRedisClusterConnection) {
133+
foreach ($channels as $channel) {
134+
$connection->publish($channel, $payload);
135+
}
136+
} elseif ($connection instanceof PredisClusterConnection &&
137+
$connection->client()->getConnection() instanceof RedisCluster) {
138+
$randomClusterNodeConnection = new PredisConnection(
139+
$connection->client()->getClientBy('slot', mt_rand(0, 16383))
140+
);
141+
142+
if ($events = $connection->getEventDispatcher()) {
143+
$randomClusterNodeConnection->setEventDispatcher($events);
144+
}
145+
146+
$randomClusterNodeConnection->eval(
147+
$this->broadcastMultipleChannelsScript(),
148+
0, $payload, ...$this->formatChannels($channels)
149+
);
150+
} else {
151+
$connection->eval(
152+
$this->broadcastMultipleChannelsScript(),
153+
0, $payload, ...$this->formatChannels($channels)
154+
);
155+
}
132156
} catch (ConnectionException|RedisException $e) {
133157
throw new BroadcastException(
134158
sprintf('Redis error: %s.', $e->getMessage())

src/Illuminate/Broadcasting/InteractsWithBroadcasting.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use Illuminate\Support\Arr;
66

7+
use function Illuminate\Support\enum_value;
8+
79
trait InteractsWithBroadcasting
810
{
911
/**
@@ -16,11 +18,13 @@ trait InteractsWithBroadcasting
1618
/**
1719
* Broadcast the event using a specific broadcaster.
1820
*
19-
* @param array|string|null $connection
21+
* @param \UnitEnum|array|string|null $connection
2022
* @return $this
2123
*/
2224
public function broadcastVia($connection = null)
2325
{
26+
$connection = enum_value($connection);
27+
2428
$this->broadcastConnection = is_null($connection)
2529
? [null]
2630
: Arr::wrap($connection);

0 commit comments

Comments
 (0)