]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Network.php
Ensure *toArray returns an array
[friendica.git] / src / Util / Network.php
index b1d072d7e93a906a5190b2847e2813200c0ec9ba..75b928bea2a2d3aeedf0d08a73c04557224f0d2f 100644 (file)
@@ -243,14 +243,14 @@ class Network
         *
         * @param string  $url       URL to post
         * @param mixed   $params    array of POST variables
-        * @param string  $headers   HTTP headers
+        * @param array   $headers   HTTP headers
         * @param int     $redirects Recursion counter for internal use - default = 0
         * @param int     $timeout   The timeout in seconds, default system config value or 60 seconds
         *
         * @return CurlResult The content
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function post(string $url, $params, string $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);
                }
 
@@ -472,7 +472,7 @@ class Network
                }
 
                foreach ($domain_blocklist as $domain_block) {
-                       if (strcasecmp($domain_block['domain'], $host) === 0) {
+                       if (fnmatch(strtolower($domain_block['domain']), strtolower($host))) {
                                return true;
                        }
                }