[11.x] Add class_exists check for Spark
's subscribed
default alias Middleware
#50489
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.
Fix ReflectionException for Missing Spark Middleware in Laravel
This PR addresses an issue where Laravel was attempting to load the
Spark\Http\Middleware\VerifyBillableIsSubscribed
middleware, which does not exist by default in Laravel 11. The aliassubscribed
was mistakenly added to the default middleware aliases inMiddleware.php
, leading to aReflectionException
when the framework tried to resolve it.When Laravel attempts to utilize the
subscribed
middleware, it triggers aReflectionException
because theSpark\Http\Middleware\VerifyBillableIsSubscribed
class does not exist. This error disrupts the functionality of applications running on Laravel 11 that rely on the default middleware stack.The PR removes the
subscribed
alias from thedefaultAliases()
method inMiddleware.php
, preventing Laravel from attempting to load a non-existent middleware class. This change ensures that the application can run without encountering a fatal error due to the missing class.