Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Laravel-$app上的分段错误->;make()_Php_Laravel - Fatal编程技术网

Php Laravel-$app上的分段错误->;make()

Php Laravel-$app上的分段错误->;make(),php,laravel,Php,Laravel,我在Laravel有一家服务提供商,看起来像这样: class ImportServiceProvider extends ServiceProvider { protected $importable = [ \MyApp\Agencies\AgencyImporter::class ]; /** * Register the application services. * * @return void */

我在Laravel有一家服务提供商,看起来像这样:

class ImportServiceProvider extends ServiceProvider
{
    protected $importable = [
        \MyApp\Agencies\AgencyImporter::class
    ];

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->resolving(Importer::class, function (Importer $importer, $app) {
            foreach($this->importable as $implementation) {
                $importer->attach($app->make($implementation));
            }
        });
    }
}
其思想是,在实例化
Importer
类时,可以将许多对象作为观察者添加到该类中

但是,当我到达代码中的这一行时,我得到了一个
分段错误
错误:

$app->make($implementation)
但是,如果我在闭包之前使用硬编码类运行代码,它可以正常工作:

$app->make(\MyApp\Agencies\AgencyImporter::class);

$this->app->resolving(Importer::class, function (Importer $importer, $app) {
       foreach($this->importable as $implementation) {
            //$importer->attach($app->make($implementation));
       }
  });

所以这似乎是关闭的问题。为什么会发生这种情况?

您使用的是PHP5.x还是PHP7?几天前我在PHP上也遇到了分段错误7@MarcinNabiałek这是PHP5这是PHP7的问题。如您所见,这在新版本7.0.1-@psantosim中使用PHP5修复。6@dj完整的版本号?5.6.x(一些PHP5.6.x也有这个bug)