douchan4674 2018-11-15 16:36
浏览 65
已采纳

Lumen 5.7.5打破了绑定分辨率

UPDATE:

See my answer

Lumen Version: 5.7.5

PHP Version: 7.2

I've just done an upgrade from 5.5 to 5.6 to 5.7 until 5.7.4 everything works as expected, as soon as I pull in 5.7.5. PHP Artisan gives me

"Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable."

Example:

PHP artisan

In Container.php line 945:

Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. Steps To Reproduce: upgrade from 5.5 to 5.6 to 5.7 and fin ally from 5.7.4 to 5.7.5.

I'm checking all the code changes and what could be causing this.

Maybe you guys have an idea ?

Here is the stack trace:

[2018-11-15 15:30:50] local.ERROR: Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /project/vendor/illuminate/container/Container.php:945
Stack trace:
0 project/vendor/illuminate/container/Container.php(785): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
1 project/vendor/illuminate/container/Container.php(658): Illuminate\Container\Container->build('Illuminate\\Cont...')
2 project/vendor/illuminate/container/Container.php(609): Illuminate\Container\Container->resolve('Illuminate\\Cont...', Array)
3 project/vendor/laravel/lumen-framework/src/Application.php(260): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
4 project/vendor/illuminate/container/Container.php(1222): Laravel\Lumen\Application->make('Illuminate\\Cont...')
5 project/vendor/laravel/lumen-framework/src/Console/Kernel.php(223): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#6 project/vendor/laravel/lumen-framework/src/Console/Kernel.php(117): Laravel\Lumen\Console\Kernel->reportException(Object(Illuminate\Contracts\Container\BindingResolutionException))
#7 project/artisan(43): Laravel\Lumen\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 {main} {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target [Illuminate\\Contracts\\Debug\\ExceptionHandler] is not instantiable. at project/vendor/illuminate/container/Container.php:945)
#[stacktrace]
#0 project/vendor/illuminate/container/Container.php(785): Illuminate\\Container\\Container->notInstantiable('Illuminate\\\\Cont...')
#1 project/vendor/illuminate/container/Container.php(658): Illuminate\\Container\\Container->build('Illuminate\\\\Cont...')
#2 project/vendor/illuminate/container/Container.php(609): Illuminate\\Container\\Container->resolve('Illuminate\\\\Cont...', Array)
#3 project/vendor/laravel/lumen-framework/src/Application.php(260): Illuminate\\Container\\Container->make('Illuminate\\\\Cont...', Array)
#4 project/vendor/illuminate/container/Container.php(1222): Laravel\\Lumen\\Application->make('Illuminate\\\\Cont...')
#5 project/vendor/laravel/lumen-framework/src/Console/Kernel.php(223): Illuminate\\Container\\Container->offsetGet('Illuminate\\\\Cont...')
#6 project/vendor/laravel/lumen-framework/src/Console/Kernel.php(117): Laravel\\Lumen\\Console\\Kernel->reportException(Object(Illuminate\\Contracts\\Container\\BindingResolutionException))
#7 project/artisan(43): Laravel\\Lumen\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#8 {main}

I've therefore created an issue on Github:

https://github.com/laravel/lumen-framework/issues/849

  • 写回答

1条回答 默认 最新

  • douzhan6474 2018-11-19 10:57
    关注

    In Lumen V5.7.6 a fix was released.

    It basically boiled down to a path overwrite during bootstrapping.

    The application.php in Lumen has been using the command static:class instead of the class path.

    This was changed to self:class to reflect the correct current path.

    This is the commit that broke it

    This is the commit that fixes it

    In some cases you may want to overwrite the base application path therefore you could add an alias when overwriting the base application path for example in an app.php while bootstrapping the application.

    e.g.

    $app->alias(overwrite\path\Application::class, \Laravel\Lumen\Application::class);
    

    Hope this helps someone altho the new commit should fix any manual overwriting to reflect the correct class path.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 r语言神经网络自变量重要性分析
  • ¥15 基于双目测规则物体尺寸
  • ¥15 wegame打不开英雄联盟
  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢