Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Ensure that an empty array cannot be provided as a set of headers
Browse files Browse the repository at this point in the history
PSR-7 requires a string or array of strings; if an array is provided, it
cannot be empty.
  • Loading branch information
weierophinney committed Sep 5, 2018
1 parent 6328ae3 commit ee4bcdc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/MessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,13 @@ private function filterHeaderValue($values)
$values = [$values];
}

if ([] === $values) {
throw new InvalidArgumentException(
'Invalid header value: must be a string or array of strings; '
. 'cannot be an empty array'
);
}

return array_map(function ($value) {
HeaderSecurity::assertValid($value);

Expand Down

0 comments on commit ee4bcdc

Please sign in to comment.