Category
language | runtime
Problem
#3144 closed VM __destruct() — refcount drop and shutdown pass call user destructors. Capability matrix: JIT = no, AOT = no.
Native-compiled apps that rely on destructors for resource cleanup (locks, handles, flush buffers) still need VM execution or miss destructor calls in JIT/AOT paths.
php-src reference
Repro (today)
<?php
class D {
public function __destruct() {
echo "bye\n";
}
}
new D();
echo "end\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro_destruct.php'
# VM: bye before end
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php repro_destruct.php'
# JIT: verify __destruct runs at end of script / scope (may differ today)
| Runtime |
Expected (Zend order) |
end then bye on scope end / request shutdown |
| VM |
#3144 behavior |
|
| JIT/AOT |
Match VM ordering |
|
Scope (this repo)
| Area |
Files |
| VM |
lib/VM.php — destructor queue / invokeDestructors (reference) |
| JIT/AOT runtime |
Register destructor callbacks at TYPE_NEW sites; run at function return / script end |
| Tests |
test/compliance/cases/language/destruct_user.phpt (+ jit) |
| Matrix |
class_destruct row in script/capability-syntax-lib.php |
Done when
Verification
./script/ci-fast.sh --filter destruct_user
Links
Category
language|runtimeProblem
#3144 closed VM
__destruct()— refcount drop and shutdown pass call user destructors. Capability matrix: JIT = no, AOT = no.Native-compiled apps that rely on destructors for resource cleanup (locks, handles, flush buffers) still need VM execution or miss destructor calls in JIT/AOT paths.
php-src reference
Zend/zend_objects.c—zend_objects_destroy_objectZend/zend_execute_API.c— shutdown destructor passRepro (today)
endthenbyeon scope end / request shutdownScope (this repo)
lib/VM.php— destructor queue /invokeDestructors(reference)TYPE_NEWsites; run at function return / script endtest/compliance/cases/language/destruct_user.phpt(+ jit)class_destructrow inscript/capability-syntax-lib.phpDone when
endthenbyeunderbin/jit.php(same as VM)gc_collect_cycles()for cycle destructors (document if VM-only)Verification
Links
__clonealready JIT (Language: __clone magic method — invoke user hook on clone (Zend parity) #3170)