From e96a5482865fad8e76f7bf366816465027ebf499 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 20 Jun 2022 18:55:17 +0200 Subject: [PATCH] Changes: - dumped default value for $input - added unknown 'platform' which prevents an "Undefined index: platform in /var/www/.../src/Model/GServer.php on line 940" error --- src/Model/GServer.php | 7 +++++-- tests/src/Util/StringsTest.php | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index e5c1bb3b69..f6c5e14af2 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -918,8 +918,11 @@ class GServer return []; } - $server = ['detection-method' => self::DETECT_NODEINFO_2, - 'register_policy' => Register::CLOSED]; + $server = [ + 'detection-method' => self::DETECT_NODEINFO_2, + 'register_policy' => Register::CLOSED, + 'platform' => 'unknown', + ]; if (!empty($nodeinfo['openRegistrations'])) { $server['register_policy'] = Register::OPEN; diff --git a/tests/src/Util/StringsTest.php b/tests/src/Util/StringsTest.php index 67a8aa259c..830f97b2f2 100644 --- a/tests/src/Util/StringsTest.php +++ b/tests/src/Util/StringsTest.php @@ -119,12 +119,12 @@ class StringsTest extends TestCase /** * Tests if the string is a valid hexadecimal value * - * @param string $input - * @param bool $valid + * @param string $input Input string + * @param bool $valid Whether testing on valid or invalid * * @dataProvider dataIsHex */ - public function testIsHex(string $input = '', bool $valid = false) + public function testIsHex(string $input, bool $valid = false) { self::assertEquals($valid, Strings::isHex($input)); } -- 2.39.5