Skip to content

Response: Can't check whether I can send a header #1366

@enumag

Description

@enumag

There is a bug here:

if (!$this->httpResponse->isSent()) {
$this->httpResponse->setCode($e instanceof BadRequestException ? ($e->getCode() ?: 404) : 500);
}

The check if (!$this->httpResponse->isSent()) { is not enough to know that it is possible to send a header (or set HTTP code in this case). It can still throw this error:

trigger_error('Possible problem: you are sending a HTTP header while already having some data in output buffer. Try OutputDebugger or start session earlier.', E_USER_NOTICE);
.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions