From 0300b1116e9c8aee09f54a8be02b9cef7dc82fa7 Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Wed, 1 Jun 2016 22:03:11 +0300 Subject: [PATCH 1/7] fix method photos.move and more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Методы на подобие https://new.vk.com/dev/photos.move которые возвращает результат в виде целого числа будут выдавать ошибку. Это исправляет данную проблему. --- src/getjump/Vk/Response/Response.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/getjump/Vk/Response/Response.php b/src/getjump/Vk/Response/Response.php index 6f6cf83..c8df2d1 100644 --- a/src/getjump/Vk/Response/Response.php +++ b/src/getjump/Vk/Response/Response.php @@ -38,6 +38,10 @@ class Response implements \ArrayAccess, \Countable, \Iterator */ public function __construct($data, $callback = false) { + if(!is_array($data)) { + return $this->data = $data; + } + foreach ($data as $key => $value) { if (property_exists($this, $key)) { continue; From 2471e9531f5bd046231b91cc784c015754863e0d Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Wed, 1 Jun 2016 22:18:51 +0300 Subject: [PATCH 2/7] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f1bdde7..f678fa4 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "getjump/vk", + "name": "den67rus/vk", "description": "Library for work with API Vk.com", "keywords": ["php", "vk", "api", "library", "vkontakte"], "license": "MIT", From 489af32b15c47868c6334b962560e6b009614a56 Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Thu, 2 Jun 2016 00:26:00 +0300 Subject: [PATCH 3/7] Update Response.php --- src/getjump/Vk/Response/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getjump/Vk/Response/Response.php b/src/getjump/Vk/Response/Response.php index c8df2d1..68e95f5 100644 --- a/src/getjump/Vk/Response/Response.php +++ b/src/getjump/Vk/Response/Response.php @@ -38,7 +38,7 @@ class Response implements \ArrayAccess, \Countable, \Iterator */ public function __construct($data, $callback = false) { - if(!is_array($data)) { + if(is_string($data)) { return $this->data = $data; } From 1742ea9f8b35e017d8fcf490a510ec68bbd81b67 Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Mon, 12 Sep 2016 18:14:46 +0300 Subject: [PATCH 4/7] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f678fa4..acb7ba2 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "guzzlehttp/guzzle": "4.*", + "guzzlehttp/guzzle": "6.*", "php": ">=5.4.0" }, "require-dev": { From b5b005fb95656f60f5c32d8bc4a1671005cf0ba4 Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Mon, 12 Sep 2016 18:16:09 +0300 Subject: [PATCH 5/7] Nessary changes accoding to new version of PSR --- src/getjump/Vk/RequestTransaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/getjump/Vk/RequestTransaction.php b/src/getjump/Vk/RequestTransaction.php index ee0090b..bd760e9 100644 --- a/src/getjump/Vk/RequestTransaction.php +++ b/src/getjump/Vk/RequestTransaction.php @@ -157,8 +157,8 @@ public function fetchData() $args['sig'] = md5('/method/'.$this->methodName.'?'.http_build_query($args).$this->noHttpsSecret); } - $data = $this->guzzle->post(self::URL_VK_API.$this->methodName, ['body' => $args])->json(['object' => true]); - $c = new Api($data, $this->callback); + $data = $this->guzzle->post(self::URL_VK_API.$this->methodName, ['body' => $args])->getBody()->getContents(); + $c = new Api($data, $this->callback); + $c = new Api(json_decode($data), $this->callback); return $c; } From 28006d024d82713e85459423bef25afee371cb67 Mon Sep 17 00:00:00 2001 From: Denis Sevostyanov Date: Mon, 12 Sep 2016 18:43:36 +0300 Subject: [PATCH 6/7] Update RequestTransaction.php --- src/getjump/Vk/RequestTransaction.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/getjump/Vk/RequestTransaction.php b/src/getjump/Vk/RequestTransaction.php index bd760e9..7244f09 100644 --- a/src/getjump/Vk/RequestTransaction.php +++ b/src/getjump/Vk/RequestTransaction.php @@ -157,8 +157,8 @@ public function fetchData() $args['sig'] = md5('/method/'.$this->methodName.'?'.http_build_query($args).$this->noHttpsSecret); } - $data = $this->guzzle->post(self::URL_VK_API.$this->methodName, ['body' => $args])->getBody()->getContents(); - $c = new Api($data, $this->callback); + $c = new Api(json_decode($data), $this->callback); + $data = $this->guzzle->post(self::URL_VK_API.$this->methodName, ['form_params' => $args])->getBody()->getContents(); + $c = new Api(json_decode($data), $this->callback); return $c; } From 57082f05fde070fe7781aeae5ab47e8ea0ff55a6 Mon Sep 17 00:00:00 2001 From: den67rus Date: Thu, 5 Sep 2019 00:41:22 +0300 Subject: [PATCH 7/7] fix: support PHP 7.3 --- src/getjump/Vk/Response/Response.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/getjump/Vk/Response/Response.php b/src/getjump/Vk/Response/Response.php index 68e95f5..87dbe29 100644 --- a/src/getjump/Vk/Response/Response.php +++ b/src/getjump/Vk/Response/Response.php @@ -60,7 +60,11 @@ public function __construct($data, $callback = false) } $this->count = !isset($data->count) ? false : $data->count; if (is_array($data) || !isset($data->items)) { - $this->count = count($data); + if(is_array($data)) { + $this->count = count($data); + } else { + $this->count = 0; + } if (is_array($data) && is_callable($callback)) { foreach ($data as $d) { $this->data[] = call_user_func_array($callback, [$d]);