Session saving problem, getting PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0
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 Fatal error: Exception thrown without a stack frame in Unknown on line 0
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开发者_StackOverflow社区 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.
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.
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 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?
I'm not sure but perhaps if you create a custom serialize() function you can find the problem.
精彩评论