简体   繁体   English

Symfony2 PHP 5.4.4无法更改活动会话的ID

[英]Symfony2 PHP 5.4.4 Cannot change the ID of an active session

Currently, we install our web application in Symfony2 and we find a blocking problem. 当前,我们在Symfony2中安装了Web应用程序,但发现了阻塞问题。

  • linux Debian Wheezy linux Debian Wheezy
  • PHP 5.4.4 PHP 5.4.4
  • Symfony version 2.1.10-DEV - app/dev/debug Symfony 2.1.10-DEV版本-app / dev / debug

The fatal error to the exception : 致命错误的例外:

vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php throw new \\LogicException('Cannot change the ID of an active session'); 供应商/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php抛出新的\\ LogicException(“无法更改活动会话的ID”);

Stack Trace : 堆栈跟踪 :

in kernel.root_dir/cache/dev/classes.php at line 484 -+ public function setId($id) { if ($this->isActive()) { throw new \\LogicException('Cannot change the ID of an active session'); 在484行的kernel.root_dir / cache / dev / classes.php中-+公共函数setId($ id){if($ this-> isActive()){throw new \\ LogicException('无法更改活动会话的ID '); } session_id($id); } session_id($ id); at AbstractProxy ->setId ('09g5hbsvg1apk8d32k52l19rr5') in kernel.root_dir/cache/dev/classes.php at line 208 -+ at NativeSessionStorage ->setId ('09g5hbsvg1apk8d32k52l19rr5') in kernel.root_dir/cache/dev/classes.php at line 780 -+ at Session ->setId ('09g5hbsvg1apk8d32k52l19rr5') in /home/wwwmain/www_v5/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php at line 54 -+ at TestSessionListener ->onKernelRequest (object(GetResponseEvent)) at call_user_func (array(object(TestSessionListener), 'onKernelRequest'), object(GetResponseEvent)) in /home/wwwmain/www_v5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php at line 139 -+ at ContainerAwareTraceableEventDispatcher ->doDispatch (array(array(object(ProfilerListener), 'onKernelRequest'), array(object(TestSessionListener), 'onKernelRequest'), array(object(SessionListener), 'onKernelRequest'), array(object(RouterListener), 'onKernelRequest'), arr 在kernel.root_dir / cache / dev / classes.php的AbstractProxy-> setId('09g5hbsvg1apk8d32k52l19rr5')处-在NativeSessionStorage处-+ setId('09g5hbsvg1apk8d32k52l19rr5')在kernel.root_dir / cache / dev / classes中。第780行-+在会话-> setId('09g5hbsvg1apk8d32k52l19rr5')在/home/wwwmain/www_v5/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php在第54行-+在TestSessionListener->在/ home / wwwmain / www_v5 / vendor / symfony / symfony / src / Symfony / Component / HttpKernel / Debug中的call_user_func(array(object(TestSessionListener),'onKernelRequest'),object(GetResponseEvent))中的onKernelRequest(object(GetSessionResponseEvent)) /ContainerAwareTraceableEventDispatcher.php在第139行-+在ContainerAwareTraceableEventDispatcher-> doDispatch(array(array(object(ProfilerListener),'onKernelRequest'),array(object(TestSessionListener),'onKernelRequest'),array(object(SessionListener),'onKernelRequest '),array(object(RouterListener),'onKernelRequest'),arr ay(object(LocaleListener), 'onKernelRequest'), array(object(Firewall), 'onKernelRequest'), array(object(RequestListener), 'onKernelRequest'), array(object(TwigExtension2), 'onKernelRequest'), array(object(RequestListener), 'onKernelRequest')), 'kernel.request', object(GetResponseEvent)) in kernel.root_dir/cache/dev/classes.php at line 4781 -+ at EventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent)) in kernel.root_dir/cache/dev/classes.php at line 4999 -+ at ContainerAwareEventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent)) in /home/wwwmain/www_v5/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php at line 78 -+ at ContainerAwareTraceableEventDispatcher ->dispatch ('kernel.request', object(GetResponseEvent)) in kernel.root_dir/bootstrap.php.cache at line 1412 -+ at HttpKernel ->handleRaw (object(Request), '1') in kernel.root_dir/bootstrap.php.cache at line 1392 -+ at HttpKernel ->handle (object(Req ay(object(LocaleListener),'onKernelRequest'),array(object(Firewall),'onKernelRequest'),array(object(RequestListener),'onKernelRequest'),array(object(TwigExtension2),'onKernelRequest'),array(第4781行的kernel.root_dir / cache / dev / classes.php中的object(RequestListener),'onKernelRequest')),'kernel.request',object(GetResponseEvent))-在EventDispatcher-> dispatch('kernel.request'第4999行的kernel.root_dir / cache / dev / classes.php中的object(GetResponseEvent))-在/ home / wwwmain / www_v5 / vendor /中的ContainerAwareEventDispatcher-> dispatch('kernel.request',object(GetResponseEvent)) symfony / symfony / src / Symfony / Component / HttpKernel / Debug / ContainerAwareTraceableEventDispatcher.php在第78行-+在ContainerAwareTraceableEventDispatcher-> dispatch('kernel.request',object(GetResponseEvent))在kernel.root_dir / bootstrap.php.cache中第1412行-+在HttpKernel-> handleRaw(object(Request),'1')在kernel.root_dir / bootstrap.php.cache在第1392行-+在HttpKernel-> handle(object(Req uest), '1', true) in kernel.root_dir/bootstrap.php.cache at line 1568 -+ at HttpKernel ->handle (object(Request), '1', true) in kernel.root_dir/bootstrap.php.cache at line 619 -+ at Kernel ->handle (object(Request)) in /home/wwwmain/www_v5/web/app_dev.php at line 25 -+ uest),'1',true)在1568行的kernel.root_dir / bootstrap.php.cache中-+在HttpKernel中->在kernel.root_dir / bootstrap.php中处理(object(Request),'1',true)。 619行缓存-+内核处->第25行/home/wwwmain/www_v5/web/app_dev.php中的handle(object(Request))

Logs : 日志:

DEBUG - Notified event "kernel.request" to listener "Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener::onKernelRequest". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ EventListener \\ ProfilerListener :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Bundle\\FrameworkBundle\\EventListener\\TestSessionListener::onKernelRequest". 调试-通知侦听器“ Symfony \\ Bundle \\ FrameworkBundle \\ EventListener \\ TestSessionListener :: onKernelRequest”的事件“ kernel.request”。 DEBUG - Notified event "kernel.exception" to listener "Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener::onKernelException". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ EventListener \\ ProfilerListener :: onKernelException”的已通知事件“ kernel.exception”。 DEBUG - Notified event "kernel.exception" to listener "Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener::onKernelException". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ EventListener \\ ExceptionListener :: onKernelException”的已通知事件“ kernel.exception”。 CRITICAL - LogicException: Cannot change the ID of an active session (uncaught exception) at /home/wwwmain/www_v5/app/cache/dev/classes.php line 484 DEBUG - Notified event "kernel.request" to listener "Symfony\\Component\\HttpKernel\\EventListener\\ProfilerListener::onKernelRequest". 严重-LogicException:无法在/home/wwwmain/www_v5/app/cache/dev/classes.php行中更改活动会话的ID(未捕获的异常)。DEBUG-通知侦听器“ Symfony \\ Component”的已通知事件“ kernel.request” \\ HttpKernel \\ EventListener \\ ProfilerListener :: onKernelRequest”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Bundle\\FrameworkBundle\\EventListener\\TestSessionListener::onKernelRequest". 调试-通知侦听器“ Symfony \\ Bundle \\ FrameworkBundle \\ EventListener \\ TestSessionListener :: onKernelRequest”的事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener::onKernelRequest". 调试-侦听器“ Symfony \\ Bundle \\ FrameworkBundle \\ EventListener \\ SessionListener :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ EventListener \\ RouterListener :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener::onKernelRequest". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ EventListener \\ LocaleListener :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Component\\Security\\Http\\Firewall::onKernelRequest". 调试-侦听器“ Symfony \\ Component \\ Security \\ Http \\ Firewall :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Eyrolles\\CompteBundle\\Service\\RequestListener::onKernelRequest". 调试-侦听器“ Eyrolles \\ CompteBundle \\ Service \\ RequestListener :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Eyrolles\\EcommerceBundle\\Twig\\Extension\\TwigExtension2::onKernelRequest". 调试-侦听器“ Eyrolles \\ EcommerceBundle \\ Twig \\ Extension \\ TwigExtension2 :: onKernelRequest”的已通知事件“ kernel.request”。 DEBUG - Notified event "kernel.request" to listener "Symfony\\Bundle\\AsseticBundle\\EventListener\\RequestListener::onKernelRequest". 调试-通知侦听器“ Symfony \\ Bundle \\ AsseticBundle \\ EventListener \\ RequestListener :: onKernelRequest”的事件“ kernel.request”。 DEBUG - Notified event "kernel.controller" to listener "Symfony\\Bundle\\FrameworkBundle\\DataCollector\\RouterDataCollector::onKernelController". 调试-通知侦听器“ Symfony \\ Bundle \\ FrameworkBundle \\ DataCollector \\ RouterDataCollector :: onKernelController”的事件“ kernel.controller”。 DEBUG - Notified event "kernel.controller" to listener "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ControllerListener::onKernelController". 调试-通知侦听器“ Sensio \\ Bundle \\ FrameworkExtraBundle \\ EventListener \\ ControllerListener :: onKernelController”的事件“ kernel.controller”。 DEBUG - Notified event "kernel.controller" to listener "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\ParamConverterListener::onKernelController". 调试-通知侦听器“ Sensio \\ Bundle \\ FrameworkExtraBundle \\ EventListener \\ ParamConverterListener :: onKernelController”的事件“ kernel.controller”。 DEBUG - Notified event "kernel.controller" to listener "Sensio\\Bundle\\FrameworkExtraBundle\\EventListener\\TemplateListener::onKernelController". 调试-通知侦听器“ Sensio \\ Bundle \\ FrameworkExtraBundle \\ EventListener \\ TemplateListener :: onKernelController”的事件“ kernel.controller”。 DEBUG - Notified event "kernel.controller" to listener "Symfony\\Component\\HttpKernel\\DataCollector\\RequestDataCollector::onKernelController". 调试-侦听器“ Symfony \\ Component \\ HttpKernel \\ DataCollector \\ RequestDataCollector :: onKernelController”的已通知事件“ kernel.controller”。

Any ideas, thoughts? 有什么想法,想法吗?

Looks like you are running phpunit tests? 看起来您正在运行phpunit测试? If so, then calss TestSessionListener calls Session::setId() if it finds Cookie with session name. 如果是这样,则在找到会话名称为Cookie的Cookie时,调用TestSessionListener调用Session :: setId()。

I'm, also encounter this problem. 我也遇到这个问题。 Looks like the only way is to extends this class and override "test.session.listener.class" parameter. 看起来唯一的方法是扩展此类并覆盖“ test.session.listener.class”参数。

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

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