Skip to content

Commit fa69789

Browse files
authored
Merge branch 'laravel:9.x' into 9.x
2 parents 4c0c984 + c86e883 commit fa69789

File tree

67 files changed

+2697
-426
lines changed

Some content is hidden

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

67 files changed

+2697
-426
lines changed

CHANGELOG.md

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

3-
## [Unreleased](https://github.com/laravel/framework/compare/v9.30.0...9.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v9.32.0...9.x)
4+
5+
6+
## [v9.32.0](https://github.com/laravel/framework/compare/v9.31.0...v9.32.0) - 2022-09-27
7+
8+
### Added
9+
- New env:encrypt and env:decrypt commands ([#44034](https://github.com/laravel/framework/pull/44034))
10+
- Share WithoutOverlapping key across jobs ([#44227](https://github.com/laravel/framework/pull/44227))
11+
- Add missing citext type mapping to `Illuminate/Database/Console/DatabaseInspectionCommand::$typeMappings` ([#44237](https://github.com/laravel/framework/pull/44237))
12+
- Short attribute syntax for Blade Components ([#44217](https://github.com/laravel/framework/pull/44217))
13+
- Adds source file to dd function output ([#44211](https://github.com/laravel/framework/pull/44211))
14+
- Add methods to get request data as integer or float ([#44239](https://github.com/laravel/framework/pull/44239))
15+
- Adds Eloquent User Provider query handler ([#44226](https://github.com/laravel/framework/pull/44226))
16+
- Added `Illuminate/Support/Testing/Fakes/BusFake::dispatchFakeBatch()` ([#44176](https://github.com/laravel/framework/pull/44176))
17+
- Added methods to cast Stringables ([#44238](https://github.com/laravel/framework/pull/44238))
18+
- Added `Illuminate/Routing/UrlGenerator::withKeyResolver()` ([#44254](https://github.com/laravel/framework/pull/44254))
19+
- Add a hook to the serialisation of collections ([#44272](https://github.com/laravel/framework/pull/44272))
20+
- Allow enum route bindings to have default values ([#44255](https://github.com/laravel/framework/pull/44255))
21+
- Added benchmark utility class ([b4293d7](https://github.com/laravel/framework/commit/b4293d7c18b08b363ac0af64ec04fb1d559b4698), [#44297](https://github.com/laravel/framework/pull/44297))
22+
- Added `Illuminate/Console/Scheduling/ManagesFrequencies::everyOddHour()` ([#44288](https://github.com/laravel/framework/pull/44288))
23+
24+
### Fixed
25+
- Fix incrementing string keys ([#44247](https://github.com/laravel/framework/pull/44247))
26+
- Fix bug in Fluent Class with named arguments in migrations ([#44251](https://github.com/laravel/framework/pull/44251))
27+
- Fix "about" command caching report ([#44305](https://github.com/laravel/framework/pull/44305))
28+
- Fixes memory leaks ([#44306](https://github.com/laravel/framework/pull/44306), [#44307](https://github.com/laravel/framework/pull/44307))
29+
30+
### Changed
31+
- Patch for timeless timing attack vulnerability in user login ([#44069](https://github.com/laravel/framework/pull/44069))
32+
- Refactor: register commands in artisan service ([#44257](https://github.com/laravel/framework/pull/44257))
33+
- Allow factories to recycle models with for method ([#44265](https://github.com/laravel/framework/pull/44265))
34+
- Use dedicated method for placeholder replacement in validator ([#44296](https://github.com/laravel/framework/pull/44296))
35+
36+
37+
## [v9.31.0](https://github.com/laravel/framework/compare/v9.30.1...v9.31.0) - 2022-09-20
38+
39+
### Added
40+
- Added unique deferrable initially deferred constants for PostgreSQL ([#44127](https://github.com/laravel/framework/pull/44127))
41+
- Request lifecycle duration handler ([#44122](https://github.com/laravel/framework/pull/44122))
42+
- Added Model::withoutTimestamps(...) ([#44138](https://github.com/laravel/framework/pull/44138))
43+
- Added manifestHash function to Illuminate\Foundation\Vite ([#44136](https://github.com/laravel/framework/pull/44136))
44+
- Added support for operator <=> in `/Illuminate/Collections/Traits/EnumeratesValues::operatorForWhere()` ([#44154](https://github.com/laravel/framework/pull/44154))
45+
- Added that Illuminate/Database/Connection::registerDoctrineType() can accept object as well as classname for new doctrine type ([#44149](https://github.com/laravel/framework/pull/44149))
46+
- Added Fake Batches ([#44104](https://github.com/laravel/framework/pull/44104), [#44173](https://github.com/laravel/framework/pull/44173))
47+
- Added `Model::getAppends()` ([#44180](https://github.com/laravel/framework/pull/44180))
48+
- Added missing Str::wrap() static method ([#44207](https://github.com/laravel/framework/pull/44207))
49+
- Added require `symfony/uid` ([#44202](https://github.com/laravel/framework/pull/44202))
50+
- Make Vite macroable ([#44198](https://github.com/laravel/framework/pull/44198))
51+
52+
### Fixed
53+
- Async fix in `Illuminate/Http/Client/PendingRequest` ([#44179](https://github.com/laravel/framework/pull/44179))
54+
- Fixes artisan serve command with PHP_CLI_SERVER_WORKERS environment variable ([#44204](https://github.com/laravel/framework/pull/44204))
55+
- Fixed `InteractsWithDatabase::castAsJson($value)` incorrectly handles SQLite Database ([#44196](https://github.com/laravel/framework/pull/44196))
56+
57+
### Changed
58+
- Improve Blade compilation exception messages ([#44134](https://github.com/laravel/framework/pull/44134))
59+
- Improve test failure output ([#43943](https://github.com/laravel/framework/pull/43943))
60+
- Prompt to create MySQL db when migrating ([#44153](https://github.com/laravel/framework/pull/44153))
61+
- Improve UUID and ULID support for Eloquent ([#44146](https://github.com/laravel/framework/pull/44146))
62+
63+
64+
## [v9.30.1](https://github.com/laravel/framework/compare/v9.30.0...v9.30.1) - 2022-09-15
65+
66+
### Added
67+
- Allow using a model instance in place of nested model factories ([#44107](https://github.com/laravel/framework/pull/44107))
68+
- Added UUID and ULID support for Eloquent ([#44074](https://github.com/laravel/framework/pull/44074))
69+
- Implement except method for fake classes to define what should not be faked ([#44117](https://github.com/laravel/framework/pull/44117))
70+
- Added interacts with queue middleware to send queued mailable ([#44124](https://github.com/laravel/framework/pull/44124))
71+
- Added new exception string to `Illuminate/Database/DetectsLostConnections` ([#44121](https://github.com/laravel/framework/pull/44121))
72+
73+
### Fixed
74+
- Fixed BC from [Passing event into viaQueue and viaConnection of Queued Listener](https://github.com/laravel/framework/pull/44080) ([#44137](https://github.com/laravel/framework/pull/44137))
75+
76+
### Changed
77+
- Enhance column modifying ([#44101](https://github.com/laravel/framework/pull/44101))
78+
- Allow to define which jobs should be actually dispatched when using Bus::fake ([#44106](https://github.com/laravel/framework/pull/44106))
479

580

681
## [v9.30.0](https://github.com/laravel/framework/compare/v9.29.0...v9.30.0) - 2022-09-13

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"league/flysystem-read-only": "^3.3",
9494
"league/flysystem-sftp-v3": "^3.0",
9595
"mockery/mockery": "^1.4.4",
96-
"orchestra/testbench-core": "^7.1",
96+
"orchestra/testbench-core": "^7.8",
9797
"pda/pheanstalk": "^4.0",
9898
"phpstan/phpstan": "^1.4.7",
9999
"phpunit/phpunit": "^9.5.8",

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
/**
@@ -931,4 +946,14 @@ public function setRequest(Request $request)
931946

932947
return $this;
933948
}
949+
950+
/**
951+
* Get the timebox instance used by the guard.
952+
*
953+
* @return \Illuminate\Support\Timebox
954+
*/
955+
public function getTimebox()
956+
{
957+
return $this->timebox;
958+
}
934959
}

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
/**

src/Illuminate/Console/Scheduling/ManagesFrequencies.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ public function hourlyAt($offset)
174174
return $this->spliceIntoPosition(1, $offset);
175175
}
176176

177+
/**
178+
* Schedule the event to run every odd hour.
179+
*
180+
* @return $this
181+
*/
182+
public function everyOddHour()
183+
{
184+
return $this->spliceIntoPosition(1, 0)->spliceIntoPosition(2, '1-23/2');
185+
}
186+
177187
/**
178188
* Schedule the event to run every two hours.
179189
*

src/Illuminate/Database/Console/DatabaseInspectionCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ abstract class DatabaseInspectionCommand extends Command
2424
*/
2525
protected $typeMappings = [
2626
'bit' => 'string',
27+
'citext' => 'string',
2728
'enum' => 'string',
2829
'geometry' => 'string',
2930
'geomcollection' => 'string',
3031
'linestring' => 'string',
32+
'ltree' => 'string',
3133
'multilinestring' => 'string',
3234
'multipoint' => 'string',
3335
'multipolygon' => 'string',

src/Illuminate/Database/Eloquent/Collection.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,17 +665,30 @@ public function getQueueableClass()
665665
return;
666666
}
667667

668-
$class = get_class($this->first());
668+
$class = $this->getQueueableModelClass($this->first());
669669

670670
$this->each(function ($model) use ($class) {
671-
if (get_class($model) !== $class) {
671+
if ($this->getQueueableModelClass($model) !== $class) {
672672
throw new LogicException('Queueing collections with multiple model types is not supported.');
673673
}
674674
});
675675

676676
return $class;
677677
}
678678

679+
/**
680+
* Get the queueable class name for the given model.
681+
*
682+
* @param \Illuminate\Database\Eloquent\Model $model
683+
* @return string
684+
*/
685+
protected function getQueueableModelClass($model)
686+
{
687+
return method_exists($model, 'getQueueableClassName')
688+
? $model->getQueueableClassName()
689+
: get_class($model);
690+
}
691+
679692
/**
680693
* Get the identifiers for all of the entities.
681694
*

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,18 @@ public function getKeyType()
5555

5656
return $this->keyType;
5757
}
58+
59+
/**
60+
* Get the value indicating whether the IDs are incrementing.
61+
*
62+
* @return bool
63+
*/
64+
public function getIncrementing()
65+
{
66+
if (in_array($this->getKeyName(), $this->uniqueIds())) {
67+
return false;
68+
}
69+
70+
return $this->incrementing;
71+
}
5872
}

0 commit comments

Comments
 (0)