Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ob_end_flush() in JsSse init #2175

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix buffering
Vladzimir authored and mvorisek committed Mar 22, 2024
commit a836c4a063e3671a8ac798115ef2fcf931edd2b0
4 changes: 3 additions & 1 deletion src/JsSse.php
Original file line number Diff line number Diff line change
@@ -190,8 +190,10 @@ protected function initSse(): void
}

// prevent buffering
if (ob_get_level()) {
$levels = ob_get_level();
for ($i = 0; $i < $levels; $i++) {
ob_end_flush();
}
flush();
Copy link
Member

@mvorisek mvorisek Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please explain why flush() is helpful

also note there is self::flush()

Copy link
Contributor Author

@Vladzimir Vladzimir Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please explain why flush() is helpful

I don't know. The code is taken from the example I gave. If you think it is not needed, delete it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the cause of CI failure, as it prevented HTTP code to be set later.

Does this PR now fixes your issue with output buffering together with #2175 (comment) framework you use?

}
}