diff options
author | Stanimir Bozhilov <stanimir@audriga.com> | 2022-09-22 11:25:39 +0200 |
---|---|---|
committer | Stanimir Bozhilov <stanimir@audriga.com> | 2022-09-22 11:25:39 +0200 |
commit | d80f8f6c823c531d2c54110c7d66b802a54a86da (patch) | |
tree | 205fd87b3d61d8afa7d20ff11df3ae8c3102f060 /lib/private/AppFramework/Http | |
parent | f286a9d6ac6423011eb5e513e761e61b47571bff (diff) | |
download | nextcloud-server-d80f8f6c823c531d2c54110c7d66b802a54a86da.tar.gz nextcloud-server-d80f8f6c823c531d2c54110c7d66b802a54a86da.zip |
Type hint JSON content type regex and use preg_match less
Signed-off-by: Stanimir Bozhilov <stanimir@audriga.com>
Diffstat (limited to 'lib/private/AppFramework/Http')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index b0392f11e09..ee569273a3f 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -107,7 +107,8 @@ class Request implements \ArrayAccess, \Countable, IRequest { /** @var bool */ protected $contentDecoded = false; - protected $jsonContentTypeRegex = '/application\/(\w+\+)?json/'; + /** @var string */ + protected string $jsonContentTypeRegex = '/application\/(\w+\+)?json/'; /** * @param array $vars An associative array with the following optional values: @@ -406,13 +407,12 @@ class Request implements \ArrayAccess, \Countable, IRequest { && $this->getHeader('Content-Length') !== '0' && $this->getHeader('Content-Length') !== '' && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false - && preg_match($this->jsonContentTypeRegex, $this->getHeader('Content-Type')) === 0 + && strpos($this->getHeader('Content-Type'), 'application/json') === false ) { if ($this->content === false) { throw new \LogicException( '"put" can only be accessed once if not ' - . 'application/x-www-form-urlencoded, application/json ' - . 'or other content type, related to JSON (like application/scim+json).' + . 'application/x-www-form-urlencoded or application/json.' ); } $this->content = false; |