From 35e3e912df957fe6ed78b670bae5f5442289e7dd Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 9 Dec 2023 15:34:15 -0500 Subject: [PATCH] Add support for string in $nodeinfo['protocols'] - Address https://github.com/friendica/friendica/issues/13157#issuecomment-1848404671 --- src/Model/GServer.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 432914e178..9d913f1c12 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -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; + } } }