php / php/php-src

Issue with ob handler context and execution in PHP

Aperta
#13,965 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Category: Output
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando php_request_shutdown attraverso php_output_end_all quando viene usato ob_start("system"), e analizza come viene gestito EG(current_execute_data) prima che system chiami zend_get_executed_filename. Riproduci l’esempio di PHP 8.3.3 con e senza ob_flush(); done significa che il nome del file eseguito rimane corretto durante il flushing dello shutdown.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.