Skip to content

Stdlib: ob_flush() / ob_clean() / ob_list_handlers() — missing OB chain builtins (ext/standard/output.c) #4838

Closed

Description

@PurHur

Category

stdlib

Problem

Several output-buffer chain helpers from ext/standard/output.c are still absent. ext/standard/Module.php already registers ob_start, ob_get_contents, ob_get_length, ob_get_level, ob_get_status, ob_end_*, etc. — but ob_flush, ob_clean, and ob_list_handlers are not implemented or registered (function_exists → false).

Frameworks flush nested buffers without ending them; ob_list_handlers() introspects the stack for debugging.

Note: Refresh #3588 — its title mentions ob_get_contents but that builtin is already registered; this issue tracks the remaining three.

php-src reference

Repro (failure today)

<?php
ob_start();
echo 'layer1';
ob_start();
echo 'layer2';
var_export(function_exists('ob_flush'));
var_export(function_exists('ob_clean'));
var_export(function_exists('ob_list_handlers'));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
Function Zend This compiler
ob_flush() defined missing
ob_clean() defined missing
ob_list_handlers() defined missing

Nested flush probe (done-when target):

<?php
ob_start();
echo 'a';
ob_start();
echo 'b';
ob_flush();          // flush inner to parent
echo ob_get_contents(); // parent should contain ab

Scope (this repo)

  • ext/standard/ob_flush.php, ob_clean.php, ob_list_handlers.php (new)
  • Wire to existing OB stack (ext/standard/VmOb.php or web runtime buffer list)
  • ext/standard/Module.php registration
  • test/compliance/cases/stdlib/ob_flush_clean_handlers.phpt
  • JIT: defer (VM-first) — update docs/capabilities.md via script/capability-matrix.php

Done when

  • All three functions registered; repro function_exists → true,true,true
  • Nested buffer flush/clean semantics match Zend on compliance fixture
  • ./script/ci-fast.sh --filter ob_flush_clean green

Related

Links

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 3, 2026
  2. PurHur commented on Jun 3, 2026

    @PurHur
    OwnerAuthor

    Maintainer triage: keeping #4838 as the actionable slice (missing ob_flush/ob_clean/ob_list_handlers). #3588 title is stale (mentions ob_get_contents which is already registered) — fold/close #3588 when #4838 lands.

  3. PurHur commented on Jun 5, 2026

    @PurHur
    OwnerAuthor

    Duplicate of #3588 (same missing ob_flush/ob_clean/ob_list_handlers output-buffer chain). Keeping #3588 as canonical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions