Skip to content

AOT: TypeError on ++/-- of live fopen resources (#23777) - #23794

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-23777-aot-incdec-resource
Jul 27, 2026
Merged

AOT: TypeError on ++/-- of live fopen resources (#23777)#23794
PurHur merged 1 commit into
masterfrom
agent/issue-23777-aot-incdec-resource

Conversation

@PurHur

@PurHur PurHur commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

php-src reference

  • Zend/zend_operators.c — increment/decrement on resources → TypeError

Test plan

  • Issue repro (exact):
    export PHP_COMPILER_LLVM_PATH="$(pwd)/.llvm"
    export LD_LIBRARY_PATH="$(pwd)/.llvm:$(pwd)/.llvm/lib:${LD_LIBRARY_PATH:-}"
    cat > /tmp/repro_inc_res.php <<'PHP'
    <?php
    $fh = fopen("php://memory", "r+");
    ++$fh;
    echo "no error\n";
    PHP
    PHP_COMPILER_HELPER_RUNTIME_O=0 ./phpc build -o /tmp/repro_inc_res /tmp/repro_inc_res.php
    /tmp/repro_inc_res; echo rc=$?
    Observed: stderr PHP Fatal error: Uncaught TypeError: Cannot increment resource, rc=255 (was no error / rc=0).
  • script/differential-sweep.sh --dir with g07_inc_resource.php — VM matches Zend
  • ./script/phpunit.sh --filter 'StreamIoRuntimeStandaloneTest|StreamLifecycleRuntimeStandaloneTest' — OK (3 tests)
  • Not run: full ci-local / north-star5-verify --strict

Made with Cursor

Stale helper-cache NestedJIT left VmFs::fopen as an ExternalMethod null stub
(handle 0), so ++$fh never saw a resource. Register php://memory|temp opens in
a shared JitOpenStreamHandles table NestedJIT'd with StreamIo + StreamLifecycle,
widen the ++/-- resource guard, and abort standalone AOT with Uncaught TypeError
(exit 255) like Zend.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5ec8a44 into master Jul 27, 2026
@PurHur
PurHur deleted the agent/issue-23777-aot-incdec-resource branch July 27, 2026 08:43
PurHur added a commit that referenced this pull request Jul 27, 2026
#23794 / #23797 added IncDecResourceProvenance to the spine but left
ext/standard/JitOpenStreamHandles.php (php://memory fopen table for AOT
++/-- resource guards) off the bundle. spine-sync --no-link restores
6588/6588 coverage so release-readiness spine + north-star5-fast pass.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

AOT: ++/-- on a live resource silently succeeds instead of raising TypeError (#6396 guard never fires at top-level scope)

1 participant