Laravel/Symfony: unable to load the “app” configuration file

前端 未结 2 1417
旧时难觅i
旧时难觅i 2021-02-14 22:14

After upgrading my Homestead and installing my packages I came across a strange bug. On calling php artisan the following was given as output:

In Lo         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-14 22:51

    I don't have an answer for why this happened, but I did code up an alternative to using Finder in the LoadConfiguration::getConfigurationFiles function (within \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\LoadConfiguration.php) which allows me to run php artisan commands without any issues...

    protected function getConfigurationFiles(Application $app)
    {
        $files = [];
    
        $configPath = realpath($app->configPath());
    
        $file = new \DirectoryIterator($configPath);
        while($file->valid()) {
            if(!$file->isDot() && ($file->getExtension() == 'php')) {
                $directory = $this->getNestedDirectory($file, $configPath);
                $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
            }
            $file->next();
        }
    
        ksort($files, SORT_NATURAL);
    
        return $files;
    }
    

    Hope that helps someone.

提交回复
热议问题