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

Commit ee4bcdc

Browse files
committed
Ensure that an empty array cannot be provided as a set of headers
PSR-7 requires a string or array of strings; if an array is provided, it cannot be empty.
1 parent 6328ae3 commit ee4bcdc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/MessageTrait.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,13 @@ private function filterHeaderValue($values)
385385
$values = [$values];
386386
}
387387

388+
if ([] === $values) {
389+
throw new InvalidArgumentException(
390+
'Invalid header value: must be a string or array of strings; '
391+
. 'cannot be an empty array'
392+
);
393+
}
394+
388395
return array_map(function ($value) {
389396
HeaderSecurity::assertValid($value);
390397

0 commit comments

Comments
 (0)