Project

General

Profile

Actions

Bug #88169

closed

Header value can have type int not string only.

Added by Alexey Atsyn about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2019-04-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

File: /typo3/sysext/core/Classes/Http/Message.php
Function: withHeader($name, $value)
Lines: 201...218

In this function we can see next code:

        if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) {
            throw new \InvalidArgumentException('Invalid header value for header "' . $name . '"". The value must be a string or an array of strings.', 1436717266);
        }

When I try this:

$file = BackendUtility::getRecord('sys_file', $id);
$response->withHeader('Content-Length', $file['size']);

I got exception: Invalid header value for header "Content-Length"". The value must be a string or an array of strings.

Yes, I know that I can convert int to the string. But int can be converted in string and I think this function should allow int values!

Actions

Also available in: Atom PDF