From 7adbc0540aa73bab480d94bdfe4b5a3f625e2135 Mon Sep 17 00:00:00 2001 From: GermanCoding Date: Mon, 6 Mar 2023 20:42:32 +0100 Subject: [PATCH] Fix leading space when fetch_headers is empty --- test/TlsIconTest.php | 4 ++-- tls_icon.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/TlsIconTest.php b/test/TlsIconTest.php index 0218452..f52c4d4 100644 --- a/test/TlsIconTest.php +++ b/test/TlsIconTest.php @@ -41,10 +41,10 @@ public function testStorage_Init() { $o = new tls_icon(); $this->assertSame([ - 'fetch_headers' => ' RECEIVED' + 'fetch_headers' => 'RECEIVED' ], $o->storage_init([])); $this->assertSame([ - 'fetch_headers' => ' RECEIVED' + 'fetch_headers' => 'RECEIVED' ], $o->storage_init(['fetch_headers' => null])); $this->assertSame([ 'fetch_headers' => 'foo bar RECEIVED' diff --git a/tls_icon.php b/tls_icon.php index d05a334..a6bbecc 100644 --- a/tls_icon.php +++ b/tls_icon.php @@ -42,7 +42,7 @@ function get_received_header_content($Received_Header) public function storage_init($p) { $headers = isset($p['fetch_headers']) ? $p['fetch_headers'] : ''; - $p['fetch_headers'] = trim($headers) . ' ' . strtoupper('Received'); + $p['fetch_headers'] = trim(trim($headers) . ' ' . strtoupper('Received')); return $p; }