Skip to content

Commit

Permalink
Protect against empty paths in the view:clear command (#14812)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored and taylorotwell committed Aug 14, 2016
1 parent 73ee91b commit a76f601
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Illuminate/Foundation/Console/ViewClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use RuntimeException;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;

Expand Down Expand Up @@ -48,9 +49,13 @@ public function __construct(Filesystem $files)
*/
public function fire()
{
$views = $this->files->glob($this->laravel['config']['view.compiled'].'/*');
$path = $this->laravel['config']['view.compiled'];

foreach ($views as $view) {
if (! $path) {
throw new RuntimeException('View path not found.');
}

foreach ($this->files->glob("{$path}/*") as $view) {
$this->files->delete($view);
}

Expand Down

0 comments on commit a76f601

Please sign in to comment.