码迷,mamicode.com
首页 > 其他好文 > 详细

Magento遇到Serialization is not allowed

时间:2015-05-09 20:41:04      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

It is quite famous error.

It means that somewhere you save object of SimpleXMLElement class (or its child) to the session. In your particular case it is Mage_Core_Model_Config_Element class.

When script ends his work, php tries to save all objects from $_SESSION array to the session file and tries to serialize $_SESSION array. Unfortunately, SimpleXMLElement can‘t be serialized because it wraps a libxml resource type. Resources cannot be serialized in php.

Probably, you are doing somewhere something like Mage::getSingleton(‘core/session‘)->setXXX(Mage::getConfig()->getNode(‘...‘))Mage_Core_Model_Config::getNode() returns Mage_Core_Model_Config_Element, not just string.

So, you need to find this place and either add (string) type cast or use Mage::getStoreConfig(‘...‘).


综上,找到问题所在,在session里面保存了一个SimpleXMLElement配置相关的项,该项里面包含了一个libxml资源类型值,而PHP不允许资源序列化,因此抛出异常。


Magento遇到Serialization is not allowed

标签:

原文地址:http://my.oschina.net/lxrm/blog/412787

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!