Only parse APP_URL
for default stateful domains when it's set
#279
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
If
APP_URL
is not defined in the .env, the config breaks on PHP 8.1 with a null string deprecation. Since it has to load in the service provider, artisan and composer are broken too (not sure about new installs though—I only have 8.1 via GH actions).For older versions, it's less of an issue - it merely adds
''
to thesanctum.stateful
array. Looks scary from a distance, but there's anarray_filter()
in the middleware so it's harmless... I think.Introduced in v2.9.3 via #264.
Notes
A simple
env('APP_URL', '')
would suffice for the 8.1 issue, but it still leaves the extra empty entry insanctum.stateful
. To remove any chance of worry/risk/ambiguity, this PR makes the whole thing conditional onAPP_URL
being defined.