升级我的家园并安装我的软件包后,我遇到了一个奇怪的错误。通话中php artisan
输出如下:
In LoadConfiguration.php line 68:
Unable to load the "app" configuration file.
几个人suggest https://stackoverflow.com/questions/44853899/laravel-error-unable-to-load-the-app-configuration-file-after-windows-file-r这是 Windows (10) 将文件名大写的原因。然而,这在我的文件夹中看不到,也不适用于我的 Ubuntu (18.04) 环境。
查看源代码LoadConfiguration.php
我们可以看到它正在使用Finder
类来自symfony/finder
成分。
foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
$directory = $this->getNestedDirectory($file, $configPath);
$files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
问题是查找器确实返回了一个迭代器,但不知何故无法找到我的配置文件。一个简单的scandir($configPath)
返回所有文件:
.
..
app.php
and all other files
结束通话iterator_to_array()
返回一个空数组[]
.
通过添加返回以下对象..->in($configPath)->getIterator()
:
Symfony\Component\Finder\Iterator\PathFilterIterator {#47
#matchRegexps: []
#noMatchRegexps: array:2 [
0 => "#(^|/)\..+(/|$)#"
1 => "#(^|/)\..+(/|$)#"
]
innerIterator: Symfony\Component\Finder\Iterator\FilenameFilterIterator {#43
#matchRegexps: array:1 [
0 => "#^(?=[^\.])[^/]*\.php$#"
]
#noMatchRegexps: []
innerIterator: Symfony\Component\Finder\Iterator\FileTypeFilterIterator {#39
-mode: 1
innerIterator: RecursiveIteratorIterator {#42
innerIterator: Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator {#46
-iterator: Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator {#48
-ignoreUnreadableDirs: false
-rewindable: null
-rootPath: "/home/vagrant/somepath/api/config"
-subPath: null
-directorySeparator: "/"
path: "/home/vagrant/somepath/api/config"
filename: "app.php"
basename: "app.php"
pathname: "/home/vagrant/somepath/api/config/app.php"
extension: "php"
realPath: "./config/app.php"
aTime: 2019-07-02 09:28:30
mTime: 2019-01-31 17:43:49
cTime: 2019-07-02 16:32:52
inode: 429
size: 9727
perms: 0100777
owner: 1000
group: 1000
type: "file"
writable: true
readable: true
executable: true
file: true
dir: false
link: false
}
-isRecursive: true
-excludedDirs: array:9 [
".svn" => true
"_svn" => true
"CVS" => true
"_darcs" => true
".arch-params" => true
".monotone" => true
".bzr" => true
".git" => true
".hg" => true
]
-excludedPattern: null
innerIterator: Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator {#48}
}
}
}
}
}
假设我对这些类型的迭代器一无所知。有两件事对我来说很突出:
- 很多
innerIterator
的存在。
- 一个迭代器可以找到一些东西
#48
,我们可以看到我们的config/app.php
,但是在一个里面ExcludeDirectoryFilterIterator
.
有人以前遇到过这个问题或者知道如何引导我走向正确的方向吗?
使用了以下版本:
OS: Windows 10/Ubuntu 18.04 LTS
Homestead: 9.0.1
laravel/framework: 5.8.*/5.7.*
\ symfony/finder: ^4.2/^4.1,
EDIT
将我的家园降级为v8.0.1
一切正常。但仍然没有解释为什么会发生这种情况v9.0.1
.