]> git.mxchange.org Git - friendica.git/commitdiff
Add support for string in $nodeinfo['protocols']
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 9 Dec 2023 20:34:15 +0000 (15:34 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 10 Dec 2023 02:36:57 +0000 (21:36 -0500)
- Address https://github.com/friendica/friendica/issues/13157#issuecomment-1848404671

src/Model/GServer.php

index 432914e178dee2940445665735e916684de97969..9d913f1c12075bcde27034c5b66bdd3831b35e2a 100644 (file)
@@ -1266,9 +1266,13 @@ class GServer
 
                if (!empty($nodeinfo['protocols'])) {
                        $protocols = [];
-                       foreach ($nodeinfo['protocols'] as $protocol) {
-                               if (is_string($protocol)) {
-                                       $protocols[$protocol] = true;
+                       if (is_string($nodeinfo['protocols'])) {
+                               $protocols[$nodeinfo['protocols']] = true;
+                       } else {
+                               foreach ($nodeinfo['protocols'] as $protocol) {
+                                       if (is_string($protocol)) {
+                                               $protocols[$protocol] = true;
+                                       }
                                }
                        }
 
@@ -1367,9 +1371,13 @@ class GServer
 
                if (!empty($nodeinfo['protocols'])) {
                        $protocols = [];
-                       foreach ($nodeinfo['protocols'] as $protocol) {
-                               if (is_string($protocol)) {
-                                       $protocols[$protocol] = true;
+                       if (is_string($nodeinfo['protocols'])) {
+                               $protocols[$nodeinfo['protocols']] = true;
+                       } else {
+                               foreach ($nodeinfo['protocols'] as $protocol) {
+                                       if (is_string($protocol)) {
+                                               $protocols[$protocol] = true;
+                                       }
                                }
                        }