diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-09-26 13:28:38 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-09-30 11:11:19 +0200 |
commit | 1ea09a1b8b8b7f68ec8c7ef069393ee58a0e623a (patch) | |
tree | aa002767f8d59c11c71fab3d1b27d22978cb85ec /tests/bookmark/LinkUtilsTest.php | |
parent | d0ae1ba273b6decea8d35ef79bfabb055b0fb6df (diff) | |
download | Shaarli-1ea09a1b8b8b7f68ec8c7ef069393ee58a0e623a.tar.gz Shaarli-1ea09a1b8b8b7f68ec8c7ef069393ee58a0e623a.tar.zst Shaarli-1ea09a1b8b8b7f68ec8c7ef069393ee58a0e623a.zip |
Fix warning if the encoding retrieved from external headers is invalid
Also fixed the regex to support this failing header: charset="utf-8"\r\n"
Diffstat (limited to 'tests/bookmark/LinkUtilsTest.php')
-rw-r--r-- | tests/bookmark/LinkUtilsTest.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/bookmark/LinkUtilsTest.php b/tests/bookmark/LinkUtilsTest.php index 7d4a7b89..0d07897b 100644 --- a/tests/bookmark/LinkUtilsTest.php +++ b/tests/bookmark/LinkUtilsTest.php | |||
@@ -43,6 +43,19 @@ class LinkUtilsTest extends TestCase | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /** | 45 | /** |
46 | * Test headers_extract_charset() when the charset is found with odd quotes. | ||
47 | */ | ||
48 | public function testHeadersExtractExistentCharsetWithQuotes() | ||
49 | { | ||
50 | $charset = 'x-MacCroatian'; | ||
51 | $headers = 'text/html; charset="' . $charset . '"otherstuff="test"'; | ||
52 | $this->assertEquals(strtolower($charset), header_extract_charset($headers)); | ||
53 | |||
54 | $headers = 'text/html; charset=\'' . $charset . '\'otherstuff="test"'; | ||
55 | $this->assertEquals(strtolower($charset), header_extract_charset($headers)); | ||
56 | } | ||
57 | |||
58 | /** | ||
46 | * Test headers_extract_charset() when the charset is not found. | 59 | * Test headers_extract_charset() when the charset is not found. |
47 | */ | 60 | */ |
48 | public function testHeadersExtractNonExistentCharset() | 61 | public function testHeadersExtractNonExistentCharset() |