Clear output handler status flags during handler initialization #13087
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When initializing output handlers, clears user supplied handler status flags (see all flags listed below).
Output buffers accept a bitflag for setting the operations allowed on the buffer (see
handler ability flags
below). These flags, along with the flags for handler type (seehandler types
below) and handler status (seehandler status flags
below) are stored in one bitmask internally. When initializing the buffer, the bits that represent handler type are cleared and set internally (here and here), and the rest of the user supplied bitmask is left unchanged. This has the (IMO unintended) side effect that the handler processing status can be set by the code starting the buffer.Setting the
PHP_OUTPUT_HANDLER_STARTED
status flag manually will prevent the passing of thePHP_OUTPUT_HANDLER_START
flag to the output handler function which can be used by user defined functions to identify the first time the output buffer calls the handler function. Internally, this flag cannot be set as it will only be set after the handler function first gets called.Setting the
PHP_OUTPUT_HANDLER_DISABLED
status flag manually will prevent ob_end_clean, ob_get_clean, ob_end_flush and ob_get_flush from calling the handler function. Internally, this flag will only be set when a handler function fails or whenphp_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL)
is called.php-src/main/php_output.h
Lines 31 to 44 in 73722df