{"action":"closed","issue":{"url":"https://api.github.com/repos/yiisoft/yii2-redis/issues/80","repository_url":"https://api.github.com/repos/yiisoft/yii2-redis","labels_url":"https://api.github.com/repos/yiisoft/yii2-redis/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2-redis/issues/80/comments","events_url":"https://api.github.com/repos/yiisoft/yii2-redis/issues/80/events","html_url":"https://github.com/yiisoft/yii2-redis/issues/80","id":171832408,"number":80,"title":"mb_strlen() expects parameter 1 to be string, array given","user":{"login":"githubjeka","id":874234,"avatar_url":"https://avatars.githubusercontent.com/u/874234?v=3","gravatar_id":"","url":"https://api.github.com/users/githubjeka","html_url":"https://github.com/githubjeka","followers_url":"https://api.github.com/users/githubjeka/followers","following_url":"https://api.github.com/users/githubjeka/following{/other_user}","gists_url":"https://api.github.com/users/githubjeka/gists{/gist_id}","starred_url":"https://api.github.com/users/githubjeka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githubjeka/subscriptions","organizations_url":"https://api.github.com/users/githubjeka/orgs","repos_url":"https://api.github.com/users/githubjeka/repos","events_url":"https://api.github.com/users/githubjeka/events{/privacy}","received_events_url":"https://api.github.com/users/githubjeka/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-18T07:09:31Z","updated_at":"2016-08-19T05:35:14Z","closed_at":"2016-08-19T05:35:13Z","body":"### What steps will reproduce the problem?\r\nDisable  'serializer' for cache :\r\nMy code:\r\n```php\r\n'pageCache' => [\r\n                'class' => 'yii\\filters\\PageCache',\r\n                'cache' => [\r\n                    'class' => 'yii\\redis\\Cache',\r\n                    'keyPrefix' => 'cache_yandex_map_',\r\n                    'serializer' => false,\r\n                    'redis' => [\r\n                        'hostname' => 'localhost',\r\n                        'port' => 6379,\r\n                        'database' => 0,\r\n                    ],\r\n                ],\r\n                'only' => ['static-map'],\r\n                'duration' => 60 * 60 * 12,\r\n                'enabled' => !isset($request->getAcceptableContentTypes()['text/html']),\r\n                'variations' => [\r\n                    $request->get('id'),\r\n                ],\r\n            ],\r\n```\r\n### What's expected?\r\nGet cache\r\n### What do you get instead?\r\n```\r\nPHP Warning – yii\\base\\ErrorException\r\n\r\nmb_strlen() expects parameter 1 to be string, array given\r\n1. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2-redis\\Connection.php at line 388\r\n379380381382383384385386387388389390391392393394395396397     * @throws Exception for commands that return [error reply](http://redis.io/topics/protocol#error-reply).\r\n     */\r\n    public function executeCommand($name, $params = [])\r\n    {\r\n        $this->open();\r\n \r\n        array_unshift($params, $name);\r\n        $command = '*' . count($params) . \"\\r\\n\";\r\n        foreach ($params as $arg) {\r\n                $command .= '$' . mb_strlen($arg, '8bit') . \"\\r\\n\" . $arg . \"\\r\\n\";\r\n        }\r\n \r\n        \\Yii::trace(\"Executing Redis Command: {$name}\", __METHOD__);\r\n        fwrite($this->_socket, $command);\r\n \r\n        return $this->parseResponse(implode(' ', $params));\r\n    }\r\n \r\n    /**\r\n2. yii\\base\\ErrorHandler::handleError(2, 'mb_strlen() expects parameter 1 ...', 'D:\\projects\\metering\\yii2-app-ad...', 388, ...)\r\n3. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2-redis\\Connection.php at line 388 – mb_strlen(['...', null], '8bit')\r\n382383384385386387388389390391392393394    {\r\n        $this->open();\r\n \r\n        array_unshift($params, $name);\r\n        $command = '*' . count($params) . \"\\r\\n\";\r\n        foreach ($params as $arg) {\r\n                $command .= '$' . mb_strlen($arg, '8bit') . \"\\r\\n\" . $arg . \"\\r\\n\";\r\n        }\r\n \r\n        \\Yii::trace(\"Executing Redis Command: {$name}\", __METHOD__);\r\n        fwrite($this->_socket, $command);\r\n \r\n        return $this->parseResponse(implode(' ', $params));\r\n4. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2-redis\\Cache.php at line 130 – yii\\redis\\Connection::executeCommand('SET', ['SET', 'cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 'PX', ...])\r\n124125126127128129130131132133134135136    {\r\n        if ($expire == 0) {\r\n            return (bool) $this->redis->executeCommand('SET', [$key, $value]);\r\n        } else {\r\n            $expire = (int) ($expire * 1000);\r\n \r\n            return (bool) $this->redis->executeCommand('SET', [$key, $value, 'PX', $expire]);\r\n        }\r\n    }\r\n \r\n    /**\r\n     * @inheritdoc\r\n     */\r\n5. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\caching\\Cache.php at line 220 – yii\\redis\\Cache::setValue('cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 43200000)\r\n6. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\widgets\\FragmentCache.php at line 113 – yii\\caching\\Cache::set('cache_yandex_map_6a86bc5cb2312e2...', ['...', null], 43200, null)\r\n7. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\base\\Widget.php at line 73 – yii\\widgets\\FragmentCache::run()\r\n8. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\base\\View.php at line 466 – yii\\base\\Widget::end()\r\n9. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\filters\\PageCache.php at line 220 – yii\\base\\View::endCache()\r\n10. yii\\filters\\PageCache::cacheResponse(yii\\base\\Event)\r\n11. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\base\\Component.php at line 541 – call_user_func([yii\\filters\\PageCache, 'cacheResponse'], yii\\base\\Event)\r\n12. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\web\\Response.php at line 315 – yii\\base\\Component::trigger('afterSend')\r\n13. in D:\\projects\\metering\\yii2-app-advanced\\vendor\\yiisoft\\yii2\\base\\Application.php at line 381 – yii\\web\\Response::send()\r\n14. in D:\\projects\\metering\\yii2-app-advanced\\backend\\web\\index.php at line 17 – yii\\base\\Application::run()\r\n11121314151617    require(__DIR__ . '/../../common/config/main-local.php'),\r\n    require(__DIR__ . '/../config/main.php'),\r\n    require(__DIR__ . '/../config/main-local.php')\r\n);\r\n \r\n$application = new yii\\web\\Application($config);\r\n$application->run();\r\n```\r\n\r\n### Additional info\r\nBtw, When 'serializer' => false,  for FileCache it works fine\r\n\r\n```php\r\n 'pageCache' => [\r\n                'class' => 'yii\\filters\\PageCache',\r\n                'cache' => [\r\n                    'class' => FileCache::class,\r\n                    'keyPrefix' => 'cache_yandex_map_',\r\n                    'serializer' => false,                   \r\n                ],\r\n                'only' => ['static-map'],\r\n                'duration' => 60 * 60 * 12,\r\n                'enabled' => !isset($request->getAcceptableContentTypes()['text/html']),\r\n                'variations' => [\r\n                    $request->get('id'),\r\n                ],\r\n            ],\r\n```\r\n\r\nXDebug:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/874234/17765732/6002d496-6530-11e6-8f42-9be9083f5cb7.png)\r\n\r\n| Q                | A\r\n| ---------------- | ---\r\n| YiiRedis vesion       |  \"yiisoft/yii2\": \"2.0.8\",  \"yiisoft/yii2-redis\": \"2.0.5\",\r\n| PHP version      | 7.0\r\n| Operating system | Win\r\n"}}
{"actor":{"display_login":"githubjeka"}}