[yiiqueueQueue] [10] unknown job (attempt: 1, PID: 31167) is finished with error: yiiaseErrorException: unserialize(): Error at offset 1922 of 65535 bytes

网上的解决方案:

1. 报错场景:序列化字段中有中文,反序列化时有可能会出现报错。

错误原因:写入和取出数据库的时候,编码不同,中文符号长度不同,序列化中的长度就无法匹配。

解决办法:适合 php 5.5+

//使用正则将错误的长度修正,@param $str  @return正确的序列化字符串

preg_replace_callback('#s:(d+):"(.*?)";#s',function($match){return 's:'.strlen($match[2]).':"'.$match[2].'";';},$str);

测试依旧报错,而且并没有写入库,不符合上面报错原因-从库中读数。

将中文排除后再测试一次。

2. 突然想起来我的原因是,因为将file读成了base64,特别长,所以会报这个错。 

mark一下。

原文地址:https://www.cnblogs.com/jiangtian/p/10950340.html