-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
class Country extends \yii\redis\ActiveRecord
{
public static function primaryKey()
{
return [
'alpha2', // string
];
}
public function attributes()
{
return ['alpha2', 'fullname'];
}
}
$country = new Country();
$country->alpha2 = 'CN';
$country->fullname = "the People's Republic of China";
$country->save(); // command error occurs.The error is:
Redis error: ERR Error compiling script (new function): user_script:10: 'then' expected near 's'
Redis command was: EVAL local allpks=redis.call('LRANGE','country',0,-1)
local pks={}
local n=0
local v=nil
local i=0
local key='country'
for k,pk in ipairs(allpks) do
local cfullname0=redis.call('HGET','country' .. ':a:' .. pk, 'fullname')
if cfullname0=='the People\\'s Republic of China' then
i=i+1
if i>0 then
do return redis.call('HGETALL','country:a:' .. pk) end
end
end
end
return pks 0
That's bug is from line 218 of LuaScriptBuilder.php (Version 2.0.4), the origin code is:
return "'" . addcslashes(str_replace("'", "\\'", $str), "\000\n\r\\\032") . "'";I temporarily change it to:
return "'" . addcslashes($str, "\000\n\r\\\032\047") . "'";then it works.
Metadata
Metadata
Assignees
Labels
type:bugBugBug