]> git.mxchange.org Git - friendica.git/commitdiff
Replace call to parse_url() with Uri instanciation in Util\Proxy
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 23 Nov 2022 18:41:13 +0000 (13:41 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 25 Nov 2022 13:13:05 +0000 (08:13 -0500)
- Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1321796513

src/Util/Proxy.php

index fc7d369ad528d1b4d89f9e9c76aeb6d5c034dfb6..aad09d118b1c81f431ff076f3badb028c23588e7 100644 (file)
@@ -24,6 +24,7 @@ namespace Friendica\Util;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
 use Friendica\DI;
+use GuzzleHttp\Psr7\Uri;
 
 /**
  * Proxy utilities class
@@ -173,12 +174,15 @@ class Proxy
         */
        private static function parseQuery(string $url): array
        {
-               $query = parse_url($url, PHP_URL_QUERY);
-               $query = html_entity_decode($query);
+               try {
+                       $uri = new Uri($url);
 
-               parse_str($query, $arr);
+                       parse_str($uri->getQuery(), $arr);
 
-               return $arr;
+                       return $arr;
+               } catch (\Throwable $e) {
+                       return [];
+               }
        }
 
        /**