Skip to content

ContentLengthPlugin doesn't work with Diactoros #55

@lunika

Description

@lunika
Q A
Bug? yes
New Feature? no

Actual Behavior

ContentLengthPlugin has a conflict when Diactoros is used. MessageInterface::withHeader expects a string or a string collection for the value parameter and Diactoros checks if value respects this. ContentLengthPlugin inject an integer so an exception is thrown by Diactoros.

Expected Behavior

inject a string for the value paramter into MessageInterface::withHeader method

Steps to Reproduce

use the ContentLengthPlugin with Diactoros

Possible Solutions

cast StreamInterface::getSize return value in string here :

$request = $request->withHeader('Content-Length', (string) $stream->getSize());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions