From 7d610869dcfd6e46cfe54bae0436ffbb6e2851df Mon Sep 17 00:00:00 2001 From: Tom Sommer Date: Fri, 9 Oct 2026 17:38:38 +0200 Subject: [PATCH] Fix AbstractRdapService::remove() deleting the wrong array element The offset of the definition in the targets list was used to unset an element of the service tuple itself, so removing one target dropped the whole targets list (or the URL list) of that service. Remove the target from the targets list and drop the service once it has none. --- src/Services/AbstractRdapService.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Services/AbstractRdapService.php b/src/Services/AbstractRdapService.php index 43dbfef..a823e3a 100644 --- a/src/Services/AbstractRdapService.php +++ b/src/Services/AbstractRdapService.php @@ -10,7 +10,6 @@ use DateTimeImmutable; use DateTimeInterface; use DateTimeZone; -use function array_key_exists; use function array_keys; use function array_merge; use function array_search; @@ -279,15 +278,14 @@ public function remove(string $definition): void if ($offset === false) { continue; } - if (array_key_exists($offset, $this->services[$key])) { - unset($this->services[$key][$offset]); - } - if (empty($this->services[$key])) { + unset($this->services[$key][0][$offset]); + if (empty($this->services[$key][0])) { unset($this->services[$key]); continue; } - $this->services[$key] = array_values($this->services[$key]); + $this->services[$key][0] = array_values($this->services[$key][0]); } + $this->services = array_values($this->services); } /**