Skip to content

Commit 45cf8b8

Browse files
committed
Merge branch '9.x'
# Conflicts: # src/Illuminate/Foundation/Application.php
2 parents cd143ec + ab5cddb commit 45cf8b8

File tree

19 files changed

+333
-32
lines changed

19 files changed

+333
-32
lines changed

src/Illuminate/Auth/SessionGuard.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,12 @@ protected function clearUserDataFromStorage()
628628
{
629629
$this->session->remove($this->getName());
630630

631+
$this->getCookieJar()->unqueue($this->getRecallerName());
632+
631633
if (! is_null($this->recaller())) {
632-
$this->getCookieJar()->queue($this->getCookieJar()
633-
->forget($this->getRecallerName()));
634+
$this->getCookieJar()->queue(
635+
$this->getCookieJar()->forget($this->getRecallerName())
636+
);
634637
}
635638
}
636639

src/Illuminate/Console/Scheduling/ScheduleListCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,14 @@ private function getClosureLocation(CallbackEvent $event)
209209
);
210210
}
211211

212+
if (is_string($callback)) {
213+
return $callback;
214+
}
215+
212216
if (is_array($callback)) {
213-
return sprintf('%s::%s', $callback[0]::class, $callback[1]);
217+
$className = is_string($callback[0]) ? $callback[0] : $callback[0]::class;
218+
219+
return sprintf('%s::%s', $className, $callback[1]);
214220
}
215221

216222
return sprintf('%s::__invoke', $callback::class);

src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ protected function setClassCastableAttribute($key, $value)
11101110
{
11111111
$caster = $this->resolveCasterClass($key);
11121112

1113-
$this->attributes = array_merge(
1113+
$this->attributes = array_replace(
11141114
$this->attributes,
11151115
$this->normalizeCastClassResponse($key, $caster->set(
11161116
$this, $key, $value, $this->attributes

src/Illuminate/Encryption/Encrypter.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,21 @@ protected function getJsonPayload($payload)
229229
*/
230230
protected function validPayload($payload)
231231
{
232-
return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) &&
233-
strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length(strtolower($this->cipher));
232+
if (! is_array($payload)) {
233+
return false;
234+
}
235+
236+
foreach (['iv', 'value', 'mac'] as $item) {
237+
if (! isset($payload[$item]) || ! is_string($payload[$item])) {
238+
return false;
239+
}
240+
}
241+
242+
if (isset($payload['tag']) && ! is_string($payload['tag'])) {
243+
return false;
244+
}
245+
246+
return strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length(strtolower($this->cipher));
234247
}
235248

236249
/**

src/Illuminate/Foundation/Bootstrap/HandleExceptions.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ public function handleError($level, $message, $file = '', $line = 0, $context =
8787
*/
8888
public function handleDeprecationError($message, $file, $line, $level = E_DEPRECATED)
8989
{
90-
if (! class_exists(LogManager::class)
91-
|| ! static::$app->hasBeenBootstrapped()
92-
|| static::$app->runningUnitTests()
93-
) {
90+
if ($this->shouldIgnoreDeprecationErrors()) {
9491
return;
9592
}
9693

@@ -115,6 +112,18 @@ public function handleDeprecationError($message, $file, $line, $level = E_DEPREC
115112
});
116113
}
117114

115+
/**
116+
* Determine if deprecation errors should be ignored.
117+
*
118+
* @return bool
119+
*/
120+
protected function shouldIgnoreDeprecationErrors()
121+
{
122+
return ! class_exists(LogManager::class)
123+
|| ! static::$app->hasBeenBootstrapped()
124+
|| static::$app->runningUnitTests();
125+
}
126+
118127
/**
119128
* Ensure the "deprecations" logger is configured.
120129
*

src/Illuminate/Foundation/Vite.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function useStyleTagAttributes($attributes)
233233
/**
234234
* Use the given callback to resolve attributes for preload tags.
235235
*
236-
* @param (callable(string, string, ?array, ?array): array)|array $attributes
236+
* @param (callable(string, string, ?array, ?array): array|false)|array|false $attributes
237237
* @return $this
238238
*/
239239
public function usePreloadTagAttributes($attributes)
@@ -351,8 +351,8 @@ public function __invoke($entrypoints, $buildDirectory = null)
351351
*
352352
* @param string $src
353353
* @param string $url
354-
* @param ?array $chunk
355-
* @param ?array $manifest
354+
* @param array|null $chunk
355+
* @param array|null $manifest
356356
* @return string
357357
*/
358358
protected function makeTagForChunk($src, $url, $chunk, $manifest)
@@ -386,12 +386,16 @@ protected function makeTagForChunk($src, $url, $chunk, $manifest)
386386
* @param string $url
387387
* @param array $chunk
388388
* @param array $manifest
389-
* @return string|null
389+
* @return string
390390
*/
391391
protected function makePreloadTagForChunk($src, $url, $chunk, $manifest)
392392
{
393393
$attributes = $this->resolvePreloadTagAttributes($src, $url, $chunk, $manifest);
394394

395+
if ($attributes === false) {
396+
return '';
397+
}
398+
395399
$this->preloadedAssets[$url] = $this->parseAttributes(
396400
Collection::make($attributes)->forget('href')->all()
397401
);
@@ -404,8 +408,8 @@ protected function makePreloadTagForChunk($src, $url, $chunk, $manifest)
404408
*
405409
* @param string $src
406410
* @param string $url
407-
* @param ?array $chunk
408-
* @param ?array $manifest
411+
* @param array|null $chunk
412+
* @param array|null $manifest
409413
* @return array
410414
*/
411415
protected function resolveScriptTagAttributes($src, $url, $chunk, $manifest)
@@ -426,8 +430,8 @@ protected function resolveScriptTagAttributes($src, $url, $chunk, $manifest)
426430
*
427431
* @param string $src
428432
* @param string $url
429-
* @param ?array $chunk
430-
* @param ?array $manifest
433+
* @param array|null $chunk
434+
* @param array|null $manifest
431435
* @return array
432436
*/
433437
protected function resolveStylesheetTagAttributes($src, $url, $chunk, $manifest)
@@ -450,7 +454,7 @@ protected function resolveStylesheetTagAttributes($src, $url, $chunk, $manifest)
450454
* @param string $url
451455
* @param array $chunk
452456
* @param array $manifest
453-
* @return array
457+
* @return array|false
454458
*/
455459
protected function resolvePreloadTagAttributes($src, $url, $chunk, $manifest)
456460
{
@@ -472,7 +476,11 @@ protected function resolvePreloadTagAttributes($src, $url, $chunk, $manifest)
472476
: $attributes;
473477

474478
foreach ($this->preloadTagAttributesResolvers as $resolver) {
475-
$attributes = array_merge($attributes, $resolver($src, $url, $chunk, $manifest));
479+
if (false === ($resolvedAttributes = $resolver($src, $url, $chunk, $manifest))) {
480+
return false;
481+
}
482+
483+
$attributes = array_merge($attributes, $resolvedAttributes);
476484
}
477485

478486
return $attributes;

src/Illuminate/Queue/InteractsWithQueue.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Illuminate\Queue;
44

55
use Illuminate\Contracts\Queue\Job as JobContract;
6+
use InvalidArgumentException;
7+
use Throwable;
68

79
trait InteractsWithQueue
810
{
@@ -43,8 +45,12 @@ public function delete()
4345
*/
4446
public function fail($exception = null)
4547
{
46-
if ($this->job) {
47-
$this->job->fail($exception);
48+
if ($exception instanceof Throwable || is_null($exception)) {
49+
if ($this->job) {
50+
return $this->job->fail($exception);
51+
}
52+
} else {
53+
throw new InvalidArgumentException('The fail method requires an instance of Throwable.');
4854
}
4955
}
5056

src/Illuminate/Session/Store.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
use Illuminate\Support\Arr;
88
use Illuminate\Support\MessageBag;
99
use Illuminate\Support\Str;
10+
use Illuminate\Support\Traits\Macroable;
1011
use Illuminate\Support\ViewErrorBag;
1112
use SessionHandlerInterface;
1213
use stdClass;
1314

1415
class Store implements Session
1516
{
17+
use Macroable;
18+
1619
/**
1720
* The session ID.
1821
*

src/Illuminate/Support/Facades/Http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* @method static \Illuminate\Http\Client\PendingRequest withMiddleware(callable $middleware)
5050
* @method static \Illuminate\Http\Client\PendingRequest beforeSending(callable $callback)
5151
* @method static \Illuminate\Http\Client\PendingRequest throw(callable|null $callback = null)
52-
* @method static \Illuminate\Http\Client\PendingRequest throwIf(callable|bool $condition, callable|null $throwCallback)
52+
* @method static \Illuminate\Http\Client\PendingRequest throwIf(callable|bool $condition)
5353
* @method static \Illuminate\Http\Client\PendingRequest throwUnless(bool $condition)
5454
* @method static \Illuminate\Http\Client\PendingRequest dump()
5555
* @method static \Illuminate\Http\Client\PendingRequest dd()

src/Illuminate/Support/Facades/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
* @method static void setHandler(\SessionHandlerInterface $handler)
6060
* @method static bool handlerNeedsRequest()
6161
* @method static void setRequestOnHandler(\Illuminate\Http\Request $request)
62+
* @method static void macro(string $name, object|callable $macro)
63+
* @method static void mixin(object $mixin, bool $replace = true)
64+
* @method static bool hasMacro(string $name)
65+
* @method static void flushMacros()
6266
*
6367
* @see \Illuminate\Session\SessionManager
6468
*/

0 commit comments

Comments
 (0)