Category
stdlib — shell exec + output buffering
Problem
With an active ob_start() buffer, system() and passthru() must route command stdout into the buffer (Zend does not echo to real stdout). This compiler echoes directly; ob_get_clean() returns an empty string while Zend captures 'hi\n'.
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_system_ob_capture.php'
# VM stdout leaks "hi" + var_export([\"hi\", \"\"]); Zend: var_export([\"hi\", \"hi\\n\"]) only
| Call |
Zend ob_get_clean() |
This compiler |
ob_start(); system('echo hi'); |
'hi\n' |
'' (plus leaked stdout) |
ob_start(); passthru('echo hi'); |
'hi\n' |
'' (plus leaked stdout) |
exec('echo hi', $out, $code) |
populates $out ✓ |
populates $out ✓ |
php-src reference
Repro
<?php
ob_start();
$r = system('echo hi');
$o = ob_get_clean();
var_export([$r, $o]); // Zend: ['hi', "hi\n"]; VM: ['hi', '']
Committed repro: test/repro/maintainer_gap_system_ob_capture.php.
Scope (PHP-in-PHP)
| Path |
Work |
ext/standard/VmExec.php (or equivalent) |
Route system()/passthru() stdout through OB layer / VmOb |
ext/standard/VmOb.php |
Ensure shell builtins use same write path as echo |
Prefer PHP OB integration — no new C exec output path.
Done when (php-src-strict)
Related
Category
stdlib— shell exec + output bufferingProblem
With an active
ob_start()buffer,system()andpassthru()must route command stdout into the buffer (Zend does not echo to real stdout). This compiler echoes directly;ob_get_clean()returns an empty string while Zend captures'hi\n'.ob_get_clean()ob_start(); system('echo hi');'hi\n'ob_start(); passthru('echo hi');'hi\n'exec('echo hi', $out, $code)$out✓$out✓php-src reference
ext/standard/exec.c—php_exec()output routing through SAPIphp_output_write()main/output.c— active output handler chainRepro
Committed repro:
test/repro/maintainer_gap_system_ob_capture.php.Scope (PHP-in-PHP)
ext/standard/VmExec.php(or equivalent)system()/passthru()stdout through OB layer /VmObext/standard/VmOb.phpechoPrefer PHP OB integration — no new C exec output path.
Done when (php-src-strict)
ob_start(); system('echo hi'); ob_get_clean()captures full command output (no stdout leak)passthru()systemlast line,passthruNULL)./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_system_ob_capture.php'matches Zend (no extra stdout)test/compliance/ortest/unit/Related
ob_end_cleanarg count) · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492