Skip to content

Runtime: fix user-script AOT ob stack + system()/passthru() capture (#10492) - #17452

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-process-exec-capture-10492
Jul 8, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-process-exec-capture-10492

Conversation

@PurHur

@PurHur PurHur commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Ob echo routing: ObOutputUserScriptLlvm now links the exec-capture ob stack and routes echo through ObOutputEchoJitEmit / __phpc_ob_append_bytes instead of EmbedObEchoBridge direct write(1,…).
  • Ob stack (defer gate): ObOutputExecCaptureLlvm implements ob_start / append_bytes / ob_get_clean via ObStorageGlobals when UserScriptAotDeferNestedJit is active — nested ObOutputExecCaptureJitHelper JIT segfaults in standalone AOT.
  • Exec capture (defer gate): ProcessShellExecLibc provides libc popen/fread __compiler_shell_exec; ProcessExecCaptureLlvm builds the capture hashtable with __string__separate (no buffer alias).

Fixes AOT segfault in system_passthru_ob and restores php-src behavior for child stdout through active output buffers.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_gap_system_passthru_ob.php'
# system_ob_ok=1 / passthru_ob_ok=1

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/aot/AotTest.php --filter system_passthru'
# OK (1 test, 5 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/ObOutputRuntimeShrinkTest.php test/unit/ProcessRuntimeShrinkTest.php'
# OK (7 tests)

Closes #10492

Made with Cursor

Route echo through append_bytes instead of direct write, use ObStorageGlobals
LLVM ob stack and libc popen shell_exec under UserScriptAotDeferNestedJit, and
build exec capture hashtables without nested ProcessExecCaptureNativeJitHelper.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 228b89b into master Jul 8, 2026
@PurHur
PurHur deleted the agent/runtime-php-process-exec-capture-10492 branch July 8, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: system()/passthru() bypass active output buffer — ob_get_clean() empty (ext/standard/exec.c)

1 participant