Fix BC introduced in #19188 (#19194)

This commit is contained in:
Bizley
2022-01-27 19:47:37 +01:00
committed by GitHub
parent 55de865dcf
commit 60c91eb433
4 changed files with 17 additions and 12 deletions

View File

@ -295,7 +295,7 @@ class PageCache extends ActionFilter implements DynamicContentAwareInterface
return;
}
$all = $response->headers->toArray(true);
$all = $response->headers->toOriginalArray();
if (is_array($this->cacheHeaders)) {
$filtered = [];
foreach ($this->cacheHeaders as $name) {

View File

@ -177,15 +177,20 @@ class HeaderCollection extends BaseObject implements \IteratorAggregate, \ArrayA
* Returns the collection as a PHP array.
* @return array the array representation of the collection.
* The array keys are header names, and the array values are the corresponding header values.
* Since 2.0.45 you can pass true here to get the headers list of original header names (case-sensitive) instead of
* default normalized (case-insensitive) ones.
*/
public function toArray($originalNames = false)
public function toArray()
{
if ($originalNames === false) {
return $this->_headers;
}
return $this->_headers;
}
/**
* Returns the collection as a PHP array but instead of using normalized header names as keys (like [[toArray()]])
* it uses original header names (case-sensitive).
* @return array the array representation of the collection.
* @since 2.0.45
*/
public function toOriginalArray()
{
return \array_map(function ($normalizedName) {
return $this->_headers[$normalizedName];
}, \array_flip($this->_originalHeaderNames));