Skip to content

Commit

Permalink
Merge branch 'laravel:9.x' into 9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
orange-alien authored Jun 14, 2022
2 parents f19f0ee + 3ef2cd7 commit 22f4715
Show file tree
Hide file tree
Showing 138 changed files with 3,799 additions and 316 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Pull Requests
name: pull requests

on:
pull_request_target:
types:
- opened
types: [opened]

permissions:
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Update Changelog"
name: update changelog

on:
release:
Expand Down
139 changes: 138 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,143 @@
# Release Notes for 9.x

## [Unreleased](https://github.com/laravel/framework/compare/v9.12.0...9.x)
## [Unreleased](https://github.com/laravel/framework/compare/v9.17.0...9.x)


## [v9.17.0](https://github.com/laravel/framework/compare/v9.16.0...v9.17.0) - 2022-06-07

### Added
- Added Illuminate/Database/Eloquent/Builder::withoutEagerLoad() ([#42641](https://github.com/laravel/framework/pull/42641))
- Allow random string generation to be controlled ([#42669](https://github.com/laravel/framework/pull/42669))
- Adds doesnt_start_with validation ([#42683](https://github.com/laravel/framework/pull/42683), [de35bf2](https://github.com/laravel/framework/commit/de35bf2a8ab40013d997c62b5a80cdb907c73b99))
- Added quarterlyOn cron schedule frequency command ([#42692](https://github.com/laravel/framework/pull/42692))

### Fixed
- Free reserved memory before handling fatal errors ([#42630](https://github.com/laravel/framework/pull/42630), [#42646](https://github.com/laravel/framework/pull/42646))
- Prevent $mailer being reset when testing mailables that implement ShouldQueue ([#42695](https://github.com/laravel/framework/pull/42695))
- Added checks for Pusher 7.1 preps ([#42632](https://github.com/laravel/framework/pull/42632))
- Fixed grouping for user authorization ([#42664](https://github.com/laravel/framework/pull/42664))

### Changed
- Allow assertions against pushed string based pushed jobs ([#42676](https://github.com/laravel/framework/pull/42676))


## [v9.16.0](https://github.com/laravel/framework/compare/v9.15.0...v9.16.0) - 2022-06-02

### Added
- Added Eloquent withWhereHas method ([#42597](https://github.com/laravel/framework/pull/42597))
- User authentication for Pusher ([#42531](https://github.com/laravel/framework/pull/42531))
- Added additional uuid testing helpers ([#42619](https://github.com/laravel/framework/pull/42619))

### Fixed
- Fix queueable notification's ID overwritten ([#42581](https://github.com/laravel/framework/pull/42581))
- Handle undefined array key error in route ([#42606](https://github.com/laravel/framework/pull/42606))

### Deprecated
- Illuminate/Routing/Redirector::home() ([#42600](https://github.com/laravel/framework/pull/42600))


## [v9.15.0](https://github.com/laravel/framework/compare/v9.14.1...v9.15.0) - 2022-05-31

### Added
- Added --only-vendor option to route:list command ([#42549](https://github.com/laravel/framework/pull/42549))
- Added `Illuminate/Http/Client/PendingRequest::throwUnless()` ([#42556](https://github.com/laravel/framework/pull/42556))
- Added `Illuminate/Support/Str::isJson()` ([#42545](https://github.com/laravel/framework/pull/42545))
- Added `Illuminate/Filesystem/Filesystem::isEmptyDirectory()` ([#42559](https://github.com/laravel/framework/pull/42559))
- Added `Add counts to route:list command` ([#42551](https://github.com/laravel/framework/pull/42551))
- Support kebab case for slot name shortcut ([#42574](https://github.com/laravel/framework/pull/42574))

### Revered
- Revert digits changes in validation ([c113768](https://github.com/laravel/framework/commit/c113768dbd47de7466d703108eaf8155916d5666), [#42562](https://github.com/laravel/framework/pull/42562))

### Fixed
- Fix getting '0' from route parameter in Authorize middleware ([#42582](https://github.com/laravel/framework/pull/42582))

### Changed
- Retain the original attribute value during validation of an array key with a dot for correct failure message ([#42395](https://github.com/laravel/framework/pull/42395))
- Allow bootable test traits to teardown ([#42521](https://github.com/laravel/framework/pull/42521))
- Pass thrown exception to $sleepMilliseconds closure in retry helper ([#42532](https://github.com/laravel/framework/pull/42532))
- Make HasTimestamps::updateTimestamps chainable ([#42533](https://github.com/laravel/framework/pull/42533))
- Remove meaningless parameter in `Illuminate/View/Concerns/ManagesEvents` ([#42546](https://github.com/laravel/framework/pull/42546))
- Map integer parameter to parameter name when resolving binding field ([#42571](https://github.com/laravel/framework/pull/42571))
- Conditionable should return HigherOrderWhenProxy only when the args number is exactly 1 ([#42555](https://github.com/laravel/framework/pull/42555))


## [v9.14.1](https://github.com/laravel/framework/compare/v9.14.0...v9.14.1) - 2022-05-25

### Added
- Model::whereRelation add callback function ([#42491](https://github.com/laravel/framework/pull/42491))
- Add Conditionable Trait to Illuminate\Support\Carbon ([#42500](https://github.com/laravel/framework/pull/42500))

### Fixed
- Fix afterCommit and DatabaseTransactions ([#42502](https://github.com/laravel/framework/pull/42502))
- Fixed regression when only some route parameters are scoped ([#42517](https://github.com/laravel/framework/pull/42517))


## [v9.14.0](https://github.com/laravel/framework/compare/v9.13.0...v9.14.0) - 2022-05-24

### Added
- Added ability to add table comments for MySQL and Postgres ([#42401](https://github.com/laravel/framework/pull/42401))
- Added dynamic trashed factory state ([#42414](https://github.com/laravel/framework/pull/42414))
- Added Illuminate/Collections/Arr::prependKeysWith() ([#42448](https://github.com/laravel/framework/pull/42448))
- Added bootable traits to TestCase ([#42394](https://github.com/laravel/framework/pull/42394))

### Fixed
- Fix clone issue on updateOrCreate and firstOrCreate ([#42434](https://github.com/laravel/framework/pull/42434))
- Prevent double sanitized key in RateLimiter@tooManyAttempts ([#42462](https://github.com/laravel/framework/pull/42462))
- Add flush handler to output buffer for streamed test response (bugfix) ([#42481](https://github.com/laravel/framework/pull/42481))

### Changed
- Adds attaches a concise error message to SES exceptions ([#42426](https://github.com/laravel/framework/pull/42426))
- Use duplicate instead of createFromBase to clone request when routes are cached ([#42420](https://github.com/laravel/framework/pull/42420))
- Use model route key when route parameter does not specifiy custom binding field but a different parameter does ([#42425](https://github.com/laravel/framework/pull/42425))
- Adds ability to have paginate() $perPage parameter as callable with access to $total ([#42429](https://github.com/laravel/framework/pull/42429))
- Extract ServeCommand env list to static property ([#42444](https://github.com/laravel/framework/pull/42444))
- Use route parameters in view ([#42461](https://github.com/laravel/framework/pull/42461))


## [v9.13.0](https://github.com/laravel/framework/compare/v9.12.2...v9.13.0) - 2022-05-17

### Added
- Added Illuminate/Collections/Traits/EnumeratesValues::value() ([#42257](https://github.com/laravel/framework/pull/42257))
- Added new TestResponse helper: assertJsonMissingPath ([#42361](https://github.com/laravel/framework/pull/42361))
- Added Illuminate/Support/Testing/Fakes/NotificationFake::assertCount() ([#42366](https://github.com/laravel/framework/pull/42366))
- Added new DetectLostConnections ([#42377](https://github.com/laravel/framework/pull/42377), [#42382](https://github.com/laravel/framework/pull/42382))
- Added Illuminate/Testing/TestResponse::collect() ([#42384](https://github.com/laravel/framework/pull/42384))
- Added full callable support to schedule:list ([#42400](https://github.com/laravel/framework/pull/42400))
- Added `Illuminate/Collections/Arr::map()` ([#42398](https://github.com/laravel/framework/pull/42398))

### Fixed
- Fixed PruneCommand finding its usage within other traits ([#42350](https://github.com/laravel/framework/pull/42350))
- Fix assert that exception is thrown without message ([#42360](https://github.com/laravel/framework/pull/42360))

### Changed
- Skip parameter parsing for raw post body in HTTP Client ([#42364](https://github.com/laravel/framework/pull/42364))
- Consistency between digits and digits_between validation rules ([#42358](https://github.com/laravel/framework/pull/42358))
- Corrects the use of "failed_jobs" instead of "job_batches" in BatchedTableCommand ([#42389](https://github.com/laravel/framework/pull/42389))
- Update email.blade.php ([#42388](https://github.com/laravel/framework/pull/42388))
- Remove old monolog 1.x compat code ([#42392](https://github.com/laravel/framework/pull/42392))
- SesTransport: use correct Tags argument ([#42390](https://github.com/laravel/framework/pull/42390))
- Implement robust handling of forwarding of exception codes ([#42393](https://github.com/laravel/framework/pull/42393))


## [v9.12.2](https://github.com/laravel/framework/compare/v9.12.1...v9.12.2) - 2022-05-11

### Fixed
- Factory fails to eval models and factories when returned from closure ([#42344](https://github.com/laravel/framework/pull/42344))

### Changed
- Added is_string check to QueriesRelationships@requalifyWhereTables ([#42341](https://github.com/laravel/framework/pull/42341))


## [v9.12.1](https://github.com/laravel/framework/compare/v9.12.0...v9.12.1) - 2022-05-10

### Fixed
- Fix TypeError in DeadlockException ([#42337](https://github.com/laravel/framework/pull/42337))
- Fixed type mismatch on Pusher::validate_channels() ([#42340](https://github.com/laravel/framework/pull/42340))

### Changed
- Add custom segments on "remember me" for session rebuild ([#42316](https://github.com/laravel/framework/pull/42316))


## [v9.12.0](https://github.com/laravel/framework/compare/v9.11.0...v9.12.0) - 2022-05-10

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"fruitcake/php-cors": "^1.2",
"laravel/serializable-closure": "^1.0",
"league/commonmark": "^2.2",
"league/flysystem": "^3.0",
"league/flysystem": "^3.0.16",
"monolog/monolog": "^2.0",
"nesbot/carbon": "^2.53.1",
"psr/container": "^1.1.1|^2.0.1",
Expand Down Expand Up @@ -92,7 +92,7 @@
"pda/pheanstalk": "^4.0",
"phpstan/phpstan": "^1.4.7",
"phpunit/phpunit": "^9.5.8",
"predis/predis": "^1.1.9",
"predis/predis": "^1.1.9|^2.0",
"symfony/cache": "^6.0"
},
"provide": {
Expand Down Expand Up @@ -154,7 +154,7 @@
"nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).",
"pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).",
"phpunit/phpunit": "Required to use assertions and run tests (^9.5.8).",
"predis/predis": "Required to use the predis connector (^1.1.9).",
"predis/predis": "Required to use the predis connector (^1.1.9|^2.0).",
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0|^7.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^6.0).",
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
printerClass="Illuminate\Tests\IgnoreSkippedPrinter"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
Expand Down
8 changes: 2 additions & 6 deletions src/Illuminate/Auth/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public function __construct($app)
{
$this->app = $app;

$this->userResolver = function ($guard = null) {
return $this->guard($guard)->user();
};
$this->userResolver = fn ($guard = null) => $this->guard($guard)->user();
}

/**
Expand Down Expand Up @@ -204,9 +202,7 @@ public function shouldUse($name)

$this->setDefaultDriver($name);

$this->userResolver = function ($name = null) {
return $this->guard($name)->user();
};
$this->userResolver = fn ($name = null) => $this->guard($name)->user();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Auth/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ protected function registerAuthenticator()
*/
protected function registerUserResolver()
{
$this->app->bind(AuthenticatableContract::class, function ($app) {
return call_user_func($app['auth']->userResolver());
});
$this->app->bind(AuthenticatableContract::class, fn ($app) => call_user_func($app['auth']->userResolver()));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getModel($request, $model)
if ($this->isClassName($model)) {
return trim($model);
} else {
return $request->route($model, null) ?:
return $request->route($model, null) ??
((preg_match("/^['\"](.*)['\"]$/", trim($model), $matches)) ? $matches[1] : null);
}
}
Expand Down
19 changes: 19 additions & 0 deletions src/Illuminate/Broadcasting/BroadcastController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Broadcast;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class BroadcastController extends Controller
{
Expand All @@ -22,4 +23,22 @@ public function authenticate(Request $request)

return Broadcast::auth($request);
}

/**
* Authenticate the current user.
*
* See: https://pusher.com/docs/channels/server_api/authenticating-users/#user-authentication.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function authenticateUser(Request $request)
{
if ($request->hasSession()) {
$request->session()->reflash();
}

return Broadcast::resolveAuthenticatedUser($request)
?? throw new AccessDeniedHttpException;
}
}
8 changes: 8 additions & 0 deletions src/Illuminate/Broadcasting/BroadcastEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class BroadcastEvent implements ShouldQueue
*/
public $timeout;

/**
* The number of seconds to wait before retrying the job when encountering an uncaught exception.
*
* @var int
*/
public $backoff;

/**
* Create a new job handler instance.
*
Expand All @@ -46,6 +53,7 @@ public function __construct($event)
$this->event = $event;
$this->tries = property_exists($event, 'tries') ? $event->tries : null;
$this->timeout = property_exists($event, 'timeout') ? $event->timeout : null;
$this->backoff = property_exists($event, 'backoff') ? $event->backoff : null;
$this->afterCommit = property_exists($event, 'afterCommit') ? $event->afterCommit : null;
}

Expand Down
37 changes: 36 additions & 1 deletion src/Illuminate/Broadcasting/BroadcastManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct($app)
}

/**
* Register the routes for handling broadcast authentication and sockets.
* Register the routes for handling broadcast channel authentication and sockets.
*
* @param array|null $attributes
* @return void
Expand All @@ -77,6 +77,41 @@ public function routes(array $attributes = null)
});
}

/**
* Register the routes for handling broadcast user authentication.
*
* @param array|null $attributes
* @return void
*/
public function userRoutes(array $attributes = null)
{
if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) {
return;
}

$attributes = $attributes ?: ['middleware' => ['web']];

$this->app['router']->group($attributes, function ($router) {
$router->match(
['get', 'post'], '/broadcasting/user-auth',
'\\'.BroadcastController::class.'@authenticateUser'
)->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
});
}

/**
* Register the routes for handling broadcast authentication and sockets.
*
* Alias of "routes" method.
*
* @param array|null $attributes
* @return void
*/
public function channelRoutes(array $attributes = null)
{
return $this->routes($attributes);
}

/**
* Get the socket ID for the given request.
*
Expand Down
Loading

0 comments on commit 22f4715

Please sign in to comment.