Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

flush with fastcgi does not force headers to be sent #12385

Closed
Assignees
@mvorisek

Description

Description

The following code:

<?php
var_dump(headers_sent());
while (ob_get_level() !== 0) {
 ob_end_flush();
}
flush();
var_dump(headers_sent());
var_dump(ob_get_level());

Resulted in this output:

bool(false)
bool(false)
int(0)

But I expected this output instead:

bool(false)
bool(true)
int(0)

This issue is reproducible with fastcgi on Windows together with nginx.

When I output/echo any data, the headers are always sent (expected).

When I use the php internal webserver instead, the flush is enough to force the headers to be send without any data/body (expected).

I belive this is a bug, as sending headers early must be supported. Some apps might need non trivial amount of time until first byte of the response is ready, also, some apps might not output any body at all, and the headers are not sent until the script ends.

PHP Version

8.1

Operating System

Windows 10

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /