Check if the cache files are really removed #51920
Closed
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.
Currently, config:clear, event:clear, and route:clear do not check if the cache files were actually removed.
If the user running the command has only read permissions for these files, the commands simply return a “… cache cleared successfully.” message without any indication that the files weren't removed.
This problem exists because Filesystem::delete doesn't throw an exception, just returns a boolean indicating whether unlink ran successfully on all the files provided. This return value is then ignored in the command handle.
For reference, here is the filesystem delete function which is called by the clear commands:
framework/src/Illuminate/Filesystem/Filesystem.php
Lines 300 to 319 in a2f2dc2
Since this change might be considered breaking, I made the pull request to the master branch.