Issue with ob handler context and execution in PHP
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.1k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza siguiendo php_request_shutdown a través de php_output_end_all cuando se usa ob_start("system"), e inspecciona cómo se maneja EG(current_execute_data) antes de que system llame a zend_get_executed_filename. Reproduce el ejemplo de PHP 8.3.3 con y sin ob_flush(); done significa que el nombre de archivo ejecutado sigue siendo correcto durante el vaciado del shutdown.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c, php
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100