帐户创建后,Magento页面冻结/空白

时间:2012-12-28 19:08:37

标签: magento session

RE:EE v1.10.1.1

您好,

最近,我发现在用户提交表单以创建帐户后,注册流程页面会冻结。它死于'/ customer / account / createpost /'。

似乎死在第#325行的/app/code/core/Mage/Customer/controllers/AccountController.php中的这一行(

$session->setCustomerAsLoggedIn($customer);
)。

在将用户设置为登录时似乎阻塞了无效/空会话。只有在刷新冻结页面后,它才会记录/显示错误。我没有在任何日志中找到任何其他错误/警告/消息...(包括服务器日志):


a:5:{i:0;s:62:"Mage registry key "_singleton/customer/session" already exists";i:1;s:1247:"#0 /server_path/html/app/Mage.php(192): Mage::throwException('Mage registry k...')
#1 /server_path/html/app/Mage.php(446): Mage::register('_singleton/cust...', Object(Mage_Customer_Model_Session))
#2 /server_path/html/app/code/core/Mage/Customer/controllers/AccountController.php(50): Mage::getSingleton('customer/sessio...')
#3 /server_path/html/app/code/core/Mage/Customer/controllers/AccountController.php(75): Mage_Customer_AccountController->_getSession()
#4 /server_path/html/app/code/core/Mage/Core/Controller/Varien/Action.php(409): Mage_Customer_AccountController->preDispatch()
#5 /server_path/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(253): Mage_Core_Controller_Varien_Action->dispatch('create')
#6 /server_path/html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 /server_path/html/app/code/core/Mage/Core/Model/App.php(340): Mage_Core_Controller_Varien_Front->dispatch()
#8 /server_path/html/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#9 /server_path/html/index.php(95): Mage::run('', 'store')
#10 {main}";s:3:"url";s:25:"/customer/account/create/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:2:"sg";}

下一行(#326)发送欢迎电子邮件。如果#325行被注释掉,那么电子邮件仍然会被发送,如果这样做,第一次登录他们的帐户的尝试会在第137行的'/ customer / account / loginPost /'上窒息:

$session->login($login['username'], $login['password']);

刷新页面一次显示仪表板。

无论哪种方式,帐户似乎都是正确创建的,之后帐户功能正常,没有其他登录问题。

最近有一些变化,但它们都不应该与客户和/或客户/会话有任何关系......至少不是我所知道的。

有没有人对代码中任何常见的潜在的magento陷阱都有一个想法...我可以在另一个脚本/ mod中间接地做一些会导致类似这样的事情?

我一直在这样做的时间超过我应该的时间,觉得我已经回到起点没有任何线索/成功。我觉得我很遗憾/忽略了一些显而易见的事情。任何意见,建议或想法都会受到赞赏。

感谢。

尊敬, JamesD

[b]注意:[/ b]我个人最后一次检查此功能是在一两个月之前,而且它没有这样做。我已经制作/添加了一些自定义模块,但是它们不应该“直接”连接到客户和/或客户会话。

另外,一年前我们确实在'customer_login'和'customer_before_save'事件中添加了一些新增内容,但过去没有任何问题,所以我不认为其中任何一个都是原因......唯一的另一个变化是Magento从EE 1.9升级到1.10。

清空会话示例....

以下是页面阻塞时会话的内容:

Mage_Customer_Model_Session Object
    (
        [_customer:protected] => 
        [_isCustomerIdChecked:protected] => 
        [_skipSessionIdFlag:protected] => 
        [_data:protected] => Array
            (
                [_session_validator_data] => Array
                    (
                        [remote_addr] => 155.77.22.255
                        [http_via] => 
                        [http_x_forwarded_for] => 
                        [http_user_agent] => Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11
                    )

                [session_hosts] => Array
                    (
                        [www.slimgenics.com] => 1
                    )

                [id] => 
                [messages] => Mage_Core_Model_Message_Collection Object
                    (
                        [_messages:protected] => Array
                            (
                            )

                        [_lastAddedMessage:protected] => Mage_Core_Model_Message_Success Object
                            (
                                [_type:protected] => success
                                [_code:protected] => Thank you for registering.
                                [_class:protected] => 
                                [_method:protected] => 
                                [_identifier:protected] => 
                                [_isSticky:protected] => 
                            )

                    )

                [before_auth_url] => https://www.domain.com/customer/account/index/
                [no_referer] => 1
            )

        [_hasDataChanges:protected] => 1
        [_origData:protected] => 
        [_idFieldName:protected] => 
        [_isDeleted:protected] =>

2 个答案:

答案 0 :(得分:1)

您所描述的错误应该在这里提出(magento CE 1.7.0.2供参考):

// app/Mage.php:472
$registryKey = '_singleton/'.$modelClass;
if (!self::registry($registryKey)) {
    self::register($registryKey, self::getModel($modelClass, $arguments));
}

所以在注册之前立即检查这个密钥是否存在。我不认为,EE代码做了别的事情。因此,您必须回答的问题是:为什么!self::registry($registryKey) false

你有运气我挖得更深。我认为Session-Object的创建失败并返回false。这意味着对密钥的检查是正确的,但是Mage::register()中的签入失败,因为它检查isset()

// app/Mage.php:216
public static function register($key, $value, $graceful = false)
{
    if (isset(self::$_registry[$key])) {
        if ($graceful) {
            return;
        }
        self::throwException('Mage registry key "'.$key.'" already exists');
        // [...]

问题是:为什么无法创建会话对象。

答案 1 :(得分:0)

问题已经解决了。

问题源于我不知道的文件更改。 这种变化显然导致了一个循环(死亡的地方)投掷了“无法重新声明”的消息。由多次调用的文件中的“require”语句引起。

我发现这一点的唯一方法是使用自定义API。我用它来测试帐户创建功能,幸运的是,Soap处理程序能够抛出错误并将其记录在Magento error.log中(以前从未做过)。那个'redeclare'错误消息在那里,并引导我到已经更改的文件。

感谢大家的投入。