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

Document details of output buffering / output control #3126

Merged
merged 4 commits into from Jan 24, 2024

Conversation

haszi
Copy link
Contributor

@haszi haszi commented Jan 19, 2024

The aim of this PR is to document most details of output control / output buffering.

It adds three new pages to the outcontrol book:

  • output buffering in general
  • flushing system buffers (flush() and implicit flushing)
  • user-level output buffering

I've checked all related user comments in the manual, and bugs, PR's and issues on bugs.php.net, php-src and doc-en. Additionally, I've tested everything before I've added it to these pages (on the CLI and a web server) so everything on them at least "works on my machine".

If accepted, these pages or sections of it could be linked to from other output control pages.

Closes https://bugs.php.net/bug.php?id=60984
Closes https://bugs.php.net/bug.php?id=65115

Related bug report that is already resolved and can be closed https://bugs.php.net/bug.php?id=78495

reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
Comment on lines 537 to 552
<para>
The following values will not be converted to string
and have special behavior associated with them.
<itemizedlist>
<listitem>
<para>
&false; - returns the contents of the buffer
</para>
</listitem>
<listitem>
<para>
&true; - returns an empty string
</para>
</listitem>
</itemizedlist>
</para>
Copy link
Member

Choose a reason for hiding this comment

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

... Okay this is stupid. Maybe something to deprecate/fix on the php-src side...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked at the commit history of output.c and the false check was originally added for ob_gzhandler() to signal to the output buffer to return the original contents of the buffer without actually copying it.

The true check was added during the redesign of the output API without any notes on why. Returning true does exactly the same as returning null or an empty string.

reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
@haszi haszi requested a review from Girgias January 21, 2024 16:10
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Some more comments

reference/outcontrol/flushing-system-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/output-buffering.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
@haszi haszi requested a review from Girgias January 22, 2024 12:56
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Minor nits, and I think we are good :)

reference/outcontrol/output-buffering.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
reference/outcontrol/user-level-output-buffers.xml Outdated Show resolved Hide resolved
@haszi haszi requested a review from Girgias January 23, 2024 17:14
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Thank you!

@Girgias Girgias merged commit 7610e99 into php:master Jan 24, 2024
2 checks passed
@haszi
Copy link
Contributor Author

haszi commented Jan 24, 2024

Thanks!

Could you also close these related bug reports? :-)

https://bugs.php.net/bug.php?id=60984
https://bugs.php.net/bug.php?id=65115
https://bugs.php.net/bug.php?id=78495 (this one is ob_start() related but has already been fixed https://3v4l.org/39Faa#veol)

@haszi haszi deleted the Document-details-of-output-control branch January 24, 2024 17:54
@Girgias
Copy link
Member

Girgias commented Jan 25, 2024

Thanks!

Could you also close these related bug reports? :-)

https://bugs.php.net/bug.php?id=60984 https://bugs.php.net/bug.php?id=65115 https://bugs.php.net/bug.php?id=78495 (this one is ob_start() related but has already been fixed https://3v4l.org/39Faa#veol)

Done :)

rosmanov pushed a commit to rosmanov/doc-en that referenced this pull request Jan 26, 2024
Co-authored-by: haszi <haszika80@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants