Skip to content

Issue with ob handler context and execution in PHP #13965

Open
@aswingit

Description

@aswingit

Description

I am encountering an issue while working with the "ob_start" function in PHP and the callback parameter.

Description:
When utilizing ob_start("system") to initiate output buffering with the "system" callback in the provided code snippet, I've observed that the zend_get_executed_filename function fails to return the correct file name when the "system" zend function is executed.

This discrepancy occurs particularly when a flush operation happens during php_request_shutdown.

<?php
ob_start("system");
?>

Observations:
Upon debugging, I've noticed the following:

  • Omission of the ob_flush() function call results in the flushing of output handlers during php_request_shutdown.
  • Prior to the invocation of php_output_end_all, the EG(current_execute_data) variable is set to NULL.
  • Consequently, when the "system" function is executed, it operates without the context of the current executed file name, leading to unexpected behavior.

Expected Behavior:
I expect the zend_get_executed_filename function to accurately retrieve the file name, even in scenarios involving flush operations during php_request_shutdown. Is this feasible?

PHP Version

PHP 8.3.3

Operating System

No response

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