[13.x] Fix Default DevCommands Registration From Framework Vendor Path#60527
Open
hasinhayder wants to merge 1 commit into
Open
[13.x] Fix Default DevCommands Registration From Framework Vendor Path#60527hasinhayder wants to merge 1 commit into
hasinhayder wants to merge 1 commit into
Conversation
Allow Laravel's built-in dev commands to register from registerDefaults() without weakening the vendor guard for public DevCommands registration.
Contributor
|
Should be fixed already via #60526 in https://github.com/laravel/framework/releases/tag/v13.16.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 Default DevCommands Registration
Summary
This fixes Laravel's built-in
DevCommandsdefaults being blocked by the vendor registration guard when the framework is installed undervendor/laravel/framework.In a consuming application, Composer's post-autoload
php artisan package:discover --ansican fail while Laravel registers its default development commands:ArtisanServiceProviderregisters Laravel's default development commands through:DevCommands::registerDefaults();registerDefaults()uses the existing public helpers:Those helpers call
DevCommands::register(), which correctly runspreventVendorRegistration()to stop third-party vendor packages from registering development commands automatically. However, Laravel framework code also lives insidevendor/laravel/frameworkin real applications, so the guard can accidentally block Laravel's ownregisterDefaults()path.Solution
This change keeps
registerDefaults()and the public registration helpers unchanged. The only production behavior change is thatpreventVendorRegistration()now allows the existing internalDevCommands::registerDefaults()call path before continuing to enforce the vendor guard for all other public registrations.This preserves the intended behavior:
Tests
Added focused coverage for calling
registerDefaults()from a simulated vendor path while keeping the existing vendor guard coverage passing.Notes
This does not modify
ArtisanServiceProvider, does not change the default command definitions, and does not loosen the public vendor-registration guard.