-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yii2-redis,$redis->eval() error #159
Comments
Yii version 2.0.15.1 |
You should pass arguments separately instead of using array.
|
Fail. Redis::eval() expects at most 3 parameters, 7 given |
这个问题是,yii2-redis执行命令有一个判断,mb_strlen()统计参数字数,数组作为参数将会报错。不知道该怎么兼容。 |
Can you show fill stack trace of this error? |
What is |
{ |
Fixed this by using the default redis database |
This issue has originally been reported by @alu12138 at yiisoft/yii2#16613.
Moved here by @samdark.
What steps will reproduce the problem?
$redis = \Yii::$app->redis;
$redis->eval($lua, array("data1", "date2", 1, 1,time()), 2);
What is the expected result?
Executed successfully
What do you get instead?
{
"name": "PHP Warning",
"message": "mb_strlen() expects parameter 1 to be string, array given",
"code": 2,
"type": "yii\base\ErrorException",
"file": "/vendor/yiisoft/yii2-redis/src/Connection.php",
"line": 677,
"stack-trace": [
"#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'mb_strlen() exp...', '/vendor...', 677, Array)",
"#1 /vendor/yiisoft/yii2-redis/src/Connection.php(677): mb_strlen(Array, '8bit')",
"#2 /vendor/yiisoft/yii2-redis/src/Connection.php(630): yii\redis\Connection->executeCommand('EVAL', Array)",
"#3 /frontend/controllers/v1/MessageController.php(322): yii\redis\Connection->__call('eval', Array)",
"#4 /frontend/controllers/v1/MessageController.php(322): yii\redis\Connection->eval('\r\nlocal data...', Array, 4)",
"#5 [internal function]: frontend\controllers\v1\MessageController->actionOpen()",
"#6 /vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)",
"#7 /vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)",
"#8 /vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('open', Array)",
"#9 /vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('v1/message/open', Array)",
"#10 /vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(yii\web\Request))",
"#11 /frontend/web/index.php(17): yii\base\Application->run()",
"#12 {main}"
]
}
Additional info
The text was updated successfully, but these errors were encountered: