8000 Empty params may be JSON-encoded as [] or {} · SuperConnvrd/codebird-php@bc04a58 · GitHub
[go: up one dir, main page]

Skip to content

Commit bc04a58

Browse files
committed
Empty params may be JSON-encoded as [] or {}
1 parent 9c45fd0 commit bc04a58

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/codebird.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,9 @@ protected function _callApi_curl($httpmethod, $method, $params = array(), $multi
11991199
$url = $this->_getEndpoint($method);
12001200
$request_headers = array();
12011201
if ($httpmethod === 'GET') {
1202-
if (json_encode($params) !== '{}') {
1202+
if (json_encode($params) !== '{}'
1203+
&& json_encode($params) !== '[]'
1204+
) {
12031205
$url .= '?' . http_build_query($params);
12041206
}
12051207
if (! $app_only_auth) {
@@ -1295,7 +1297,6 @@ protected function _callApi_curl($httpmethod, $method, $params = array(), $multi
12951297

12961298
protected function _callApi_no_curl($httpmethod, $method, $params = array(), $multipart = false, $app_only_auth = false, $internal = false)
12971299
{
1298-
12991300
if ($internal) {
13001301
$params['adc'] = 'phone';
13011302
$params['application_id'] = 333903271;
@@ -1306,7 +1307,9 @@ protected function _callApi_no_curl($httpmethod, $method, $params = array(), $mu
13061307
$hostname = parse_url($url, PHP_URL_HOST);
13071308
$request_headers = array();
13081309
if ($httpmethod === 'GET') {
1309-
if (json_encode($params) !== '{}') {
1310+
if (json_encode($params) !== '{}'
1311+
&& json_encode($params) !== '[]'
1312+
) {
13101313
$url .= '?' . http_build_query($params);
13111314
}
13121315
if (! $app_only_auth) {

0 commit comments

Comments
 (0)
0