登录无缘无故出错 [ 新手入门 ]
我前几天做的登录功能,当时一切都没有问题的。。可是最近登录却出现了下面可恶的错误,我调了好久了,不知道为什么。。请大家帮帮忙。 PHP Error
unserialize(): Error at offset 5 of 92 bytes
/www/app/yiiframework/framework/base/CStatePersister.php(96)
084 $cacheKey=\'Yii.CStatePersister.\'.$stateFile;
085 if(($value=$cache->get($cacheKey))!==false)
086 return unserialize($value);
087 else if(($content=@file_get_contents($stateFile))!==false)
088 {
089 $cache->set($cacheKey,$content,0,new CFileCacheDependency($stateFile));
090 return unserialize($content);
091 }
092 else
093 return null;
094 }
095 else if(($content=@file_get_contents($stateFile))!==false)
096 return unserialize($content);
097 else
098 return null;
099 }
100
101 /**
102 * Saves application state in persistent storage.
103 * @param mixed $state state data (must be serializable).
104 */
105 public function save($state)
106 {
107 file_put_contents($this->stateFile,serialize($state),LOCK_EX);
108 }
Stack Trace
#0
+
/www/app/yiiframework/framework/base/CStatePersister.php(96): unserialize("a:1:{s:34:\"Yii.CSecurityManager.validationkey\";s:32:\"4f213533...")
#1
+
/www/app/yiiframework/framework/base/CApplication.php(651): CStatePersister->load()
#2
+
/www/app/yiiframework/framework/base/CApplication.php(591): CApplication->loadGlobalState()
#3
+
/www/app/yiiframework/framework/base/CSecurityManager.php(88): CApplication->getGlobalState("Yii.CSecurityManager.validationkey")
#4
+
/www/app/yiiframework/framework/base/CSecurityManager.php(270): CSecurityManager->getValidationKey()
#5
+
/www/app/yiiframework/framework/base/CSecurityManager.php(237): CSecurityManager->computeHMAC("a:4:{i:0;s:1:"1";i:1;s:23:"jian.cui@kunlun-inc.com";i:2;i:259200...", null)
#6
+
/www/app/yiiframework/framework/web/auth/CWebUser.php(481): CSecurityManager->hashData("a:4:{i:0;s:1:"1";i:1;s:23:"jian.cui@kunlun-inc.com";i:2;i:259200...")
#7
+
/www/app/yiiframework/framework/web/auth/CWebUser.php(218): CWebUser->saveToCookie(2592000)
#8
–
/www/app/legend/protected/models/LoginForm.php(71): CWebUser->login(UserIdentity, 2592000)
66 $this->_identity->authenticate();
67 }
68 if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
69 {
70 $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
71 Yii::app()->user->login($this->_identity,$duration);
72 return true;
73 }
74 else
75 return false;
76 }
#9
–
/www/app/legend/protected/controllers/SiteController.php(93): LoginForm->login()
88 // collect user input data
89 if(isset($_POST[\'LoginForm\']))
90 {
91 $model->attributes=$_POST[\'LoginForm\'];
92 // validate user input and redirect to the previous page if valid
93 if($model->validate() && $model->login())
94 {
95 $userInfo = SecurityUsers::model()->findByAttributes(array(\'username\'=>$model->username));
96
97 if ($userInfo->status == 1)
98 {
#10
+
/www/app/yiiframework/framework/web/actions/CInlineAction.php(50): SiteController->actionLogin()
#11
+
/www/app/yiiframework/framework/web/CController.php(300): CInlineAction->runWithParams(array("r" => "site/login"))
#12
+
/www/app/yiiframework/framework/web/CController.php(278): CController->runAction(CInlineAction)
#13
+
/www/app/yiiframework/framework/web/CController.php(257): CController->runActionWithFilters(CInlineAction, array())
#14
+
/www/app/yiiframework/framework/web/CWebApplication.php(277): CController->run("login")
#15
+
/www/app/yiiframework/framework/web/CWebApplication.php(136): CWebApplication->runController("site/login")
#16
+
/www/app/yiiframework/framework/base/CApplication.php(158): CWebApplication->processRequest()
#17
–
/www/app/legend/index.php(11): CApplication->run()
06 defined(\'YII_DEBUG\') or define(\'YII_DEBUG\',TRUE);
07 // specify how many levels of call stack should be shown in each log message
08 defined(\'YII_TRACE_LEVEL\') or define(\'YII_TRACE_LEVEL\',3);
09 require_once($yii);
10
11 Yii::createWebApplication($config)->run();
12
2011-10-21 17:14:33 nginx/1.0.0 Yii Framework/1.1.8
程序日志
时间 等级 类别 信息
17:14:33.274525 trace system.db.CDbConnection
Opening DB connection
in /www/app/legend/protected/models/SecurityUsers.php (35)
in /www/app/legend/protected/components/UserIdentity.php (22)
in /www/app/legend/protected/models/LoginForm.php (52)
17:14:33.276328 trace system.db.CDbCommand
Querying SQL: SHOW COLUMNS FROM `l_security_users`
in /www/app/legend/protected/models/SecurityUsers.php (35)
in /www/app/legend/protected/components/UserIdentity.php (22)
in /www/app/legend/protected/models/LoginForm.php (52)
17:14:33.279325 trace system.db.CDbCommand
Querying SQL: SHOW CREATE TABLE `l_security_users`
in /www/app/legend/protected/models/SecurityUsers.php (35)
in /www/app/legend/protected/components/UserIdentity.php (22)
in /www/app/legend/protected/models/LoginForm.php (52)
17:14:33.279913 trace system.db.ar.CActiveRecord
SecurityUsers.find()
in /www/app/legend/protected/components/UserIdentity.php (22)
in /www/app/legend/protected/models/LoginForm.php (52)
in /www/app/legend/protected/controllers/SiteController.php (93)
17:14:33.280759 trace system.db.CDbCommand
Querying SQL: SELECT * FROM `l_security_users` `t` WHERE LOWER(email=?)
LIMIT 1. Bound with 0='jian.cui@kunlun-inc.com'
in /www/app/legend/protected/components/UserIdentity.php (22)
in /www/app/legend/protected/models/LoginForm.php (52)
in /www/app/legend/protected/controllers/SiteController.php (93)
共 2 条回复
-
davidhhuan 回复于 2011-10-22 10:29 举报
我试了一下,
echo unserialize("a:1:{s:34:\"Yii.CSecurityManager.validationkey\";s:32:\"4f213533...");
报错:
Notice: unserialize(): Error at offset 49 of 64 byte
之前的数据序列化的时候有错
YiiHoney 昆仑万维
注册时间:2011-09-23
最后登录:1970-01-01
在线时长:0小时0分
最后登录:1970-01-01
在线时长:0小时0分
- 粉丝0
- 金钱275
- 威望0
- 积分275