From 7c54edd4b4b9a2c2b75b3b69a40be5a2ca2d50b4 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 10 Jun 2019 19:12:00 +0200 Subject: [PATCH] Fixing Network::post() caused by wrong argument --- mod/dfrn_confirm.php | 2 +- src/Util/Network.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 7da872f0d0..9f9684e093 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -209,7 +209,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) * */ - $res = Network::post($dfrn_confirm, $params, null, 120)->getBody(); + $res = Network::post($dfrn_confirm, $params, [], 120)->getBody(); Logger::log(' Confirm: received data: ' . $res, Logger::DATA); diff --git a/src/Util/Network.php b/src/Util/Network.php index da44fcc8f3..92265e30e6 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -250,7 +250,7 @@ class Network * @return CurlResult The content * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function post(string $url, $params, $headers = null, int $timeout = 0, int &$redirects = 0) + public static function post(string $url, $params, array $headers = [], int $timeout = 0, int &$redirects = 0) { $stamp1 = microtime(true); @@ -286,7 +286,7 @@ class Network } if (defined('LIGHTTPD')) { - if (!is_array($headers)) { + if (empty($headers)) { $headers = ['Expect:']; } else { if (!in_array('Expect:', $headers)) { @@ -295,7 +295,7 @@ class Network } } - if ($headers) { + if (!empty($headers)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); }