会话保存问题,出现PHP致命错误:在第0行的Unknown中没有堆栈框架而引发了异常 [英] Session saving problem, getting PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0

查看:67
本文介绍了会话保存问题,出现PHP致命错误:在第0行的Unknown中没有堆栈框架而引发了异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我已经在Magento电子商务平台内部编写了与第三方订单管理解决方案的集成,该平台建立在Zend框架之上.在我的本地计算机和本地开发服务器上,一切都正常运行.两台服务器均使用PHP5.2.x.部署到使用PHP 5.3.3的登台服务器时,我的部分代码中出现了此错误

Ok so I have written an integration to a third party order management solution inside of the Magento Ecommerce platform, which is built on top of the Zend Framework. Everything has worked fine on my local machine and also on my local dev server. Both Servers use PHP 5.2.x. When deploying to the Staging server which uses PHP 5.3.3 I am now getting this error in a part of my code

PHP致命错误:在第0行的Unknown中,没有堆栈框架就抛出了异常

PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0

我尝试注释掉代码段,以查看将代码范围缩小到什么程度,但运气不太好.我在Magento观察器中启动代码,该观察器调用我创建的模型,该模型也在Session中设置了一些变量.我有很多调用其他类的方法,例如我的观察者调用了我的订单模型,该模型也调用了我的客户模型,并且所有这些都在其类内部调用了几种不同的方法.通过登录和注释掉行在服务器上调试它有点困难,我没有取得很好的进展.

I have tried commenting out pieces of code to see where I can narrow it down to but with not that great of luck. I start the code in a Magento observer which calls a Model that I created that sets some variables in the Session as well. I have a lot of methods calling other classes such as my observer calls my Order Model, which that also calls my Customer Model and all of them call a few different methods inside of their classes. Its been kind of hard to debug this on the server by logging and commenting out lines, I am not making good progress.

根据我所做的研究,在我看来,这更像是我试图设置为会话的某种东西在析构函数中消亡了.我尝试在返回的返回值之前在观察者方法的末尾使用session_write_close(),以便它可能更早地向我显示错误,但实际上却使我的程序不死,并且按预期的方式工作.我不确定我是否愿意把它留在那儿,因为我确定它可能会弄乱其余的流程,但是我对此并不了解.

From the research I have done, this seems to me more like something that I am trying to set to the session is dieing in the destructor. I tried using session_write_close() at the end of my observer method before it returns, so that it might show me the error earlier on but it actually made my program not die and it worked like it was suppose to. I am not sure I am comfortable leaving that in there because I am sure it could mess the rest of the flow up but I am not that knowledgeable about this.

我只是想弄清楚调试它的最佳方法是什么.我不知道为什么将它放到那里时会起作用,以及析构函数中可能会死掉的原因,显然我没有在析构函数中抛出异常,但是我正在做的是.但是,直到我将代码放置在登台服务器上之前,它都可以正常工作.顺便说一句,它也使用了nginx而不是apache.

I am just trying to figure out what the best way to debug this is. I don't get why it works when putting that in there and what might be dieing in the destructor, obviously I am not throwing a exception in a destructor, but something I am doing is. But it has worked fine until I put the code on the Staging server. Which by the way is also using nginx instead of apache as well.

推荐答案

首先,这些东西很难调试.我认为问题在于序列化.在将对象存储在会话中之前,将对其进行序列化,以便对其进行存储.

First of all, these things are hard to debug. I think the problem lays in serialization. Before an object is stored in the session, it will be serialized so it can be stored.

在另一个项目中,我遇到了这个问题,并且得到了与您相同的错误消息.

In an other project I've had this problem and got the same error messag as you have.

Magento有几个无法序列化的类.这些类之一是Mage_Core_Config_Element.也许您使用该类?

Magento has a couple of classes which can't be serialized. One of those classes is Mage_Core_Config_Element. Perhaps you make use of that class?

我不确定,但是也许如果您创建一个自定义的serialize()函数,就可以找到问题所在.

I'm not sure but perhaps if you create a custom serialize() function you can find the problem.

这篇关于会话保存问题,出现PHP致命错误:在第0行的Unknown中没有堆栈框架而引发了异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆