Fix crash in GuidelineAssist when app/ directory does not exist#617
Merged
pushpak1300 merged 1 commit intolaravel:mainfrom Mar 2, 2026
Merged
Conversation
shouldEnforceStrictTypes() and enumContents() called file_get_contents() on the value returned by current($this->modelPaths / $this->enumPaths) without checking whether it was a real file. When app_path() is not a directory, discover() returns a sentinel array whose value is the app directory path — causing file_get_contents() to receive a directory and throw a fatal error. Add is_file() guards to both methods so they return their safe defaults (false / '') when the path is not a real file, completing the graceful degradation path already established in discover(). Fixes projects using non-standard folder structures (DDD, hexagonal architecture) where no app/ directory exists. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pushpak1300
approved these changes
Mar 2, 2026
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.
The Issue
During the installation process (
php artisan boost:install),shouldEnforceStrictTypes()andenumContents()callsfile_get_contents()on the value returned bycurrent($this->modelPaths / $this->enumPaths)without checking whether it is a real file.When
app_path()is not a directory,discover()returns a sentinel array whose value is the app directory path - causingfile_get_contents()to receive a directory and throw a fatal error.This fixes projects using non-standard folder structures where no app/ directory exists.
We're using it in a project with Ports & Adapters architecture and the Laravel app is buried in a folder similar to
src/.../Infrastructure/LaravelSolution
Add
is_file()guard to both methods so they return their safe defaults (false/ '') when the path is not a real file, completing the graceful degradation path already established indiscover().While this doesn't really maintain the same level of support for all of the different architectures where Laravel can be used, it will allow the installation to complete successfully with sensible defaults.