Category
language
Problem
PHP 8.1+ first-class callables must be Closure instances (or invokable objects with __invoke), not compile-time string/[class, method] placeholders. This build lowers strlen(...), array_slice(...), and Foo::bar(...) to strings or array pairs, so is_object($f) is false and var_export() shows 'strlen' instead of a Closure::__set_state array.
Related closed tracker #1230 (parse/lowering landed) but runtime zval type still diverges from Zend.
php-src reference
Repro
test/tmp/repro-fcc-closure-object.php:
<?php
declare(strict_types=1);
$f = strlen(...);
var_export(is_object($f));
echo PHP_EOL;
var_export($f instanceof Closure);
echo PHP_EOL;
./script/docker-exec.sh -- bash -lc 'php test/tmp/repro-fcc-closure-object.php; php bin/vm.php test/tmp/repro-fcc-closure-object.php'
| Check |
Zend |
This compiler |
is_object($f) |
true |
false |
$f instanceof Closure |
true |
false |
Also: array_slice(...) — Zend true, VM false (same lowering).
Scope
| Module |
Path |
| Compiler |
lib/Compiler.php — compileFirstClassCallable() |
| VM |
Closure / callable object construction |
| Tests |
test/compliance/cases/language/ + JIT when execute probe green |
Done when
Related
Category
languageProblem
PHP 8.1+ first-class callables must be
Closureinstances (or invokable objects with__invoke), not compile-time string/[class, method]placeholders. This build lowersstrlen(...),array_slice(...), andFoo::bar(...)to strings or array pairs, sois_object($f)is false andvar_export()shows'strlen'instead of aClosure::__set_statearray.Related closed tracker #1230 (parse/lowering landed) but runtime zval type still diverges from Zend.
php-src reference
Zend/zend_compile.c—zend_compile_first_class_callable()Zend/zend_closures.c—zend_create_closure()Repro
test/tmp/repro-fcc-closure-object.php:./script/docker-exec.sh -- bash -lc 'php test/tmp/repro-fcc-closure-object.php; php bin/vm.php test/tmp/repro-fcc-closure-object.php'is_object($f)truefalse$f instanceof ClosuretruefalseAlso:
array_slice(...)— Zendtrue, VMfalse(same lowering).Scope
lib/Compiler.php—compileFirstClassCallable()test/compliance/cases/language/+ JIT when execute probe greenDone when
strlen(...), staticFoo::bar(...), and instance[$o, 'm'](...)FCC forms areClosure(or Zend-equivalent invokable)is_callable($fcc)/call_user_func($fcc, ...)parity with Zend on the repro./script/ci-fast.sh --filter first_class(or new compliance case name) greenRelated
is_callable/call_user_funcstdlib parity