From b5165435af02cb5f6b2ddf66aa843243e1f66c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Hr=C3=A1=C5=A1ek?= Date: Wed, 18 Jan 2017 18:25:30 +0100 Subject: [PATCH] Fixed regex for Content-Type header parsing --- src/JsonSchema/Uri/Retrievers/Curl.php | 2 +- src/JsonSchema/Uri/Retrievers/FileGetContents.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JsonSchema/Uri/Retrievers/Curl.php b/src/JsonSchema/Uri/Retrievers/Curl.php index cd8414f3..9b49bd56 100644 --- a/src/JsonSchema/Uri/Retrievers/Curl.php +++ b/src/JsonSchema/Uri/Retrievers/Curl.php @@ -68,7 +68,7 @@ private function fetchMessageBody($response) */ protected function fetchContentType($response) { - if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) { + if (0 < preg_match("/Content-Type:([^;]*)/ims", $response, $match)) { $this->contentType = trim($match[1]); return true; diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index f2e73c3b..8a0c6224 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -79,7 +79,7 @@ private function fetchContentType(array $headers) */ protected static function getContentTypeMatchInHeader($header) { - if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) { + if (0 < preg_match("/Content-Type:([^;]*)/ims", $header, $match)) { return trim($match[1]); }