Allow empty string in MediaType parser.

This commit is contained in:
flash 2023-07-22 14:25:58 +00:00
parent 4aae77900b
commit 557f089ff7
2 changed files with 2 additions and 5 deletions

View file

@ -1 +1 @@
0.2307.212147
0.2307.221425

View file

@ -1,7 +1,7 @@
<?php
// MediaType.php
// Created: 2022-02-10
// Updated: 2023-07-21
// Updated: 2023-07-22
namespace Index;
@ -133,9 +133,6 @@ class MediaType implements Stringable, IComparable, IEquatable {
}
public static function parse(string $mediaTypeStr): MediaType {
if(empty($mediaTypeStr))
throw new InvalidArgumentException('Invalid media type supplied.');
$parts = explode(';', $mediaTypeStr);
$mediaTypeStr = array_shift($parts);
$mediaTypeParts = explode('/', $mediaTypeStr, 2);