简体   繁体   English

Symfony2不触发kernel.terminate事件

[英]Symfony2 not firing kernel.terminate event

I'm going to upgrade my Symfony from 2.0 to 2.5 with all this guides: 我将通过所有这些指南将Symfony从2.0升级到2.5:

https://github.com/symfony/symfony/blob/master/UPGRADE-2.1.md
https://github.com/symfony/symfony/blob/master/UPGRADE-2.2.md
https://github.com/symfony/symfony/blob/master/UPGRADE-2.3.md
https://github.com/symfony/symfony/blob/master/UPGRADE-2.4.md
https://github.com/symfony/symfony/blob/master/UPGRADE-2.5.md

My front page works but web debug toolbar throws "404 Not found". 我的首页正常工作,但是Web调试工具栏抛出“ 404 Not found”。 After whole day searching and digging trought symfony code i found: 经过一整天的搜索和挖掘,我发现了曲折的symfony代码:

  1. Web Debug Toolbar and Profiler looks fine but... Web调试工具栏和Profiler看起来不错,但是...
  2. app/cache/dev/profiler is empty (whole cache has 0777 access) app / cache / dev / profiler为空(整个缓存具有0777访问权限)
  3. kernel.terminate event wont fires (last noticed event is kernel.finish_request) kernel.terminate事件不会触发(最后注意到的事件是kernel.finish_request)
  4. i can't find place where Kernel terminate method is called (that is the last place where i stuck) 我找不到调用内核terminate方法的地方(那是我卡住的最后一个地方)

Maybe someone has simmilar problem? 也许有人有类似的问题?

3) kernel.terminate event wont fires

Ensure all the services which are listening to 'kernal.terminate' event are correctly configured. 确保正确配置了所有正在监听“ kernal.terminate”事件的服务。 ie Symfony should be able to instantiate the services which are listening to 'kernal.terminate' event. 即Symfony应该能够实例化正在监听“ kernal.terminate”事件的服务。

Reason: As Symfony dispatches 'kernal.terminate' event, the dispatcher first gets the list of services that are listening to this event. 原因:随着Symfony调度“ kernal.terminate”事件,调度程序首先获取正在侦听此事件的服务列表。 If it fails to get the list of services, it throws an exception. 如果无法获取服务列表,则会引发异常。 Since this exception is happening on terminate and the response is already sent, you will not be able to see the exception anywhere, other than logs. 由于此异常在终止时发生,并且响应已经发送,因此您将无法在日志以外的任何地方看到该异常。

If it fails to get the list of services that are listing to the 'kernal.terminate', it is most possible that there is an error in instantiating any of the services due to any reason. 如果无法将要列出的服务列表获取到“ kernal.terminate”,则最有可能由于任何原因在实例化任何服务时出错。 Eg. 例如。 the arguments passed to constructor are wrong/not available. 传递给构造函数的参数错误/不可用。

Tip: Keep tailing symfony logs and php logs while debugging. 提示:调试时请保留symfony日志和php日志。

4) i can't find place where Kernel terminate method is called

You can find it in app_dev.php or app.php 您可以在app_dev.phpapp.php找到它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM