From 4da8cb0d9bb7181bfea6c5632648712394f7097f Mon Sep 17 00:00:00 2001 From: tomolimo Date: Fri, 31 May 2024 10:30:30 +0200 Subject: [PATCH 1/2] Update ContentType.php To be able to cope with mimetype like type/* Signed-off-by: tomolimo --- src/Header/ContentType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Header/ContentType.php b/src/Header/ContentType.php index 4ed083b4..dcc258e8 100644 --- a/src/Header/ContentType.php +++ b/src/Header/ContentType.php @@ -131,7 +131,7 @@ public function toString() */ public function setType($type) { - if (! preg_match('/^[a-z-]+\/[a-z0-9.+-]+$/i', $type)) { + if (! preg_match('/^[a-z-]+\/[\*a-z0-9.+-]+$/i', $type)) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a value in the format "type/subtype"; received "%s"', __METHOD__, From d7e71e3a9dd26fd26699508bbe2e0914dd85c4ce Mon Sep 17 00:00:00 2001 From: tomolimo Date: Fri, 31 May 2024 11:50:17 +0200 Subject: [PATCH 2/2] Update ContentType.php Delete the escape char that is not needed in front of * in [] Signed-off-by: tomolimo --- src/Header/ContentType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Header/ContentType.php b/src/Header/ContentType.php index dcc258e8..6e4a233b 100644 --- a/src/Header/ContentType.php +++ b/src/Header/ContentType.php @@ -131,7 +131,7 @@ public function toString() */ public function setType($type) { - if (! preg_match('/^[a-z-]+\/[\*a-z0-9.+-]+$/i', $type)) { + if (! preg_match('/^[a-z-]+\/[*a-z0-9.+-]+$/i', $type)) { throw new Exception\InvalidArgumentException(sprintf( '%s expects a value in the format "type/subtype"; received "%s"', __METHOD__,