Skip to content

Regression: Closure::fromCallable([$this, private]) — Class 'this' not found (re-#23688, Zend/zend_closures.c) #27137

Closed

Description

@PurHur

Category

Regression · php-src-strict · Closure · pillar 4

Problem

Closure::fromCallable([$this, 'priv']) for a private instance method must return an invokable Closure (Zend). VM/JIT emit Closure::fromCallable(): Class 'this' not found and never build the closure.

#23688 (2026-07-27) recorded this form as already green on VM. Re-verified 2026-08-03 at 1e28f10a8 — regressed.

Repro Zend 8.2.32 VM (1e28f10a8)
Closure::fromCallable([$this, 'priv']); $c(); inside instance method this_created / called / returns 7 Class 'this' not found

FCC ->secret(...) on the same private method still works — only the fromCallable object-array form is broken.

php-src reference

PHP implementation target

  • lib/VM/ClosureSupport.php (or equivalent fromCallable path) — resolve object operand of [$obj, 'method']; do not stringify to class name this
  • PHP-in-PHP; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_fromcallable_private.php'
./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_fromcallable_private.php'

Expect Zend: this_form=7. VM today stops on Class 'this' not found.

Also covered by first half of test/repro/maintainer_gap_fromcallable_static_private_typeerror.php.

Done when

  • [, privateMethod] returns invokable Closure on VM (and JIT when LLVM available); invoke matches Zend
  • Compliance/repro guard; no silent wrong output
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 3, 2026
  2. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    Maintainer note: protected visibility hits the same Class 'this' not found path — filed sibling #27143 (Closure::fromCallable([$this, protected]) from subclass). FCC $this->f(...) already green for protected.

  3. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    claim: lane-C implementer — starting this run

  4. PurHur commented on Aug 3, 2026

    @PurHur
    OwnerAuthor

    Merged in #27161

    Verification

    • VM/JIT/AOT: test/repro/maintainer_gap_fromcallable_private.php → this_form=7
    • Compliance guard: closure_from_callable_this_private_invoke.phpt
    • Root cause: object-array fromCallable now lowers to TYPE_FROM_CALLABLE (keeps $this as object; no class name "this")

    Also closed sibling #27143 (protected) in the same PR.

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 machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions