Fixing Network::post() caused by wrong argument

This commit is contained in:
Philipp Holzer 2019-06-10 19:12:00 +02:00
parent 9491c63934
commit 7c54edd4b4
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
2 changed files with 4 additions and 4 deletions

View file

@ -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); Logger::log(' Confirm: received data: ' . $res, Logger::DATA);

View file

@ -250,7 +250,7 @@ class Network
* @return CurlResult The content * @return CurlResult The content
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @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); $stamp1 = microtime(true);
@ -286,7 +286,7 @@ class Network
} }
if (defined('LIGHTTPD')) { if (defined('LIGHTTPD')) {
if (!is_array($headers)) { if (empty($headers)) {
$headers = ['Expect:']; $headers = ['Expect:'];
} else { } else {
if (!in_array('Expect:', $headers)) { if (!in_array('Expect:', $headers)) {
@ -295,7 +295,7 @@ class Network
} }
} }
if ($headers) { if (!empty($headers)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
} }