From 23330fe04389797dd9f44a71bb345584e250fc46 Mon Sep 17 00:00:00 2001 From: Alexander Sagen Date: Fri, 26 Apr 2024 11:40:49 +0200 Subject: [PATCH] Encoding\DkimTagValue: Allow trailing separator --- composer.json | 2 +- src/encoding/dkim_tag_value.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f05be61..54eca61 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "alexrsagen/obie", - "version": "1.6.6", + "version": "1.6.7", "type": "framework", "description": "Obie is a simple PHP framework. It aims to provide basic services needed for any web app.", "keywords": ["framework", "php", "http", "template", "view", "router", "routing", "model", "models", "session", "sessions"], diff --git a/src/encoding/dkim_tag_value.php b/src/encoding/dkim_tag_value.php index 22b2933..43a25f1 100644 --- a/src/encoding/dkim_tag_value.php +++ b/src/encoding/dkim_tag_value.php @@ -23,7 +23,13 @@ public static function decode(string $input, bool $strict = true, string $versio $output = new TagList(); $tag_list = explode(';', $input); - foreach ($tag_list as $tag_spec) { + foreach ($tag_list as $i => $tag_spec) { + // allow trailing separator + if ($i === count($tag_list) - 1 && strlen($tag_spec) === 0) { + break; + } + + // extract tag-name and tag-value $tag_name_value = explode('=', $tag_spec, 2); if (count($tag_name_value) !== 2) { Log::warning('DkimTagValue: unexpected tag-spec without tag-value');