From 558a6669d17b37fe073f1d8dee54bf1bcec722be Mon Sep 17 00:00:00 2001 From: eyJhb Date: Tue, 14 Mar 2017 15:41:40 +0100 Subject: [PATCH 1/2] fixed Factory.php including all files, also non .php files eg. .php~ --- src/Illuminate/Database/Eloquent/Factory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Database/Eloquent/Factory.php b/src/Illuminate/Database/Eloquent/Factory.php index c86ba1aa0455..938cea59ab30 100644 --- a/src/Illuminate/Database/Eloquent/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factory.php @@ -199,6 +199,10 @@ public function load($path) if (is_dir($path)) { foreach (Finder::create()->files()->in($path) as $file) { + if(pathinfo($file->getRealPath(), PATHINFO_EXTENSION) !== 'php') { + continue; + } + require $file->getRealPath(); } } From 99a0d06238e6b0d4064d2f0bdbb6ded8566a4a80 Mon Sep 17 00:00:00 2001 From: eyJhb Date: Tue, 14 Mar 2017 17:12:58 +0100 Subject: [PATCH 2/2] FIX: use Finder to only loop over *.php in database factories --- src/Illuminate/Database/Eloquent/Factory.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Illuminate/Database/Eloquent/Factory.php b/src/Illuminate/Database/Eloquent/Factory.php index 938cea59ab30..0b57576e17bd 100644 --- a/src/Illuminate/Database/Eloquent/Factory.php +++ b/src/Illuminate/Database/Eloquent/Factory.php @@ -198,11 +198,7 @@ public function load($path) $factory = $this; if (is_dir($path)) { - foreach (Finder::create()->files()->in($path) as $file) { - if(pathinfo($file->getRealPath(), PATHINFO_EXTENSION) !== 'php') { - continue; - } - + foreach (Finder::create()->files()->name('*.php')->in($path) as $file) { require $file->getRealPath(); } }