Merge pull request #10345 from MrPetovan/bug/warnings

Ensure nodeinfo-provided protocols are strings in Model\GServer::parseNodeinfo2
This commit is contained in:
Philipp 2021-05-31 07:37:30 +02:00 committed by GitHub
commit f5da6f4ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -802,6 +802,7 @@ class GServer
/** /**
* Parses Nodeinfo 2 * Parses Nodeinfo 2
* *
* @see https://git.feneas.org/jaywink/nodeinfo2
* @param string $nodeinfo_url address of the nodeinfo path * @param string $nodeinfo_url address of the nodeinfo path
* @return array Server data * @return array Server data
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
@ -850,8 +851,10 @@ class GServer
if (!empty($nodeinfo['protocols'])) { if (!empty($nodeinfo['protocols'])) {
$protocols = []; $protocols = [];
foreach ($nodeinfo['protocols'] as $protocol) { foreach ($nodeinfo['protocols'] as $protocol) {
if (is_string($protocol)) {
$protocols[$protocol] = true; $protocols[$protocol] = true;
} }
}
if (!empty($protocols['dfrn'])) { if (!empty($protocols['dfrn'])) {
$server['network'] = Protocol::DFRN; $server['network'] = Protocol::DFRN;