From b333efce8b47f67e805a96c4b8d5514a4e8bef2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 20 Dec 2023 10:14:41 -0300 Subject: [PATCH] Specify text enconding when detecting PNG media types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UTF-8 can't be used for that. Signed-off-by: Maurício Meneghini Fauth --- libraries/classes/Mime.php | 2 +- phpstan-baseline.neon | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/libraries/classes/Mime.php b/libraries/classes/Mime.php index 8c8a76abcb..f1f38106c6 100644 --- a/libraries/classes/Mime.php +++ b/libraries/classes/Mime.php @@ -37,7 +37,7 @@ class Mime return 'image/gif'; } - if ($len >= 4 && mb_substr($test, 0, 4) == "\x89PNG") { + if ($len >= 4 && mb_substr($test, 0, 4, '8bit') === "\x89PNG") { return 'image/png'; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d090c346f4..302eb5a708 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -6365,21 +6365,6 @@ parameters: count: 1 path: libraries/classes/Plugins/Import/ImportOds.php - - - message: "#^Offset 'name' does not exist on SimpleXMLElement\\|null\\.$#" - count: 2 - path: libraries/classes/Plugins/Import/ImportOds.php - - - - message: "#^Offset 'number\\-columns…' does not exist on SimpleXMLElement\\|null\\.$#" - count: 2 - path: libraries/classes/Plugins/Import/ImportOds.php - - - - message: "#^Parameter \\#1 \\$cell_attrs of method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) expects SimpleXMLElement, SimpleXMLElement\\|null given\\.$#" - count: 1 - path: libraries/classes/Plugins/Import/ImportOds.php - - message: "#^Parameter \\#1 \\$sheets of method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:iterateOverTables\\(\\) expects array\\|SimpleXMLElement, array\\|SimpleXMLElement\\|null given\\.$#" count: 1 @@ -6415,21 +6400,6 @@ parameters: count: 1 path: libraries/classes/Plugins/Import/ImportXml.php - - - message: "#^Offset 'charset' does not exist on SimpleXMLElement\\|null\\.$#" - count: 1 - path: libraries/classes/Plugins/Import/ImportXml.php - - - - message: "#^Offset 'collation' does not exist on SimpleXMLElement\\|null\\.$#" - count: 1 - path: libraries/classes/Plugins/Import/ImportXml.php - - - - message: "#^Offset 'name' does not exist on SimpleXMLElement\\|null\\.$#" - count: 8 - path: libraries/classes/Plugins/Import/ImportXml.php - - message: "#^Parameter \\#1 \\$str1 of function strcmp expects string, array\\, array\\, string\\>\\|string\\>\\|string given\\.$#" count: 1