Category
php-in-php · php-src-strict (runtime semantics from PHP VM path)
Problem
unserialize() VM lowering uses PHP (ext/standard/VmUnserializeFormat.php), but JIT/AOT still emit native __compiler_unserialize LLVM cloned from runtime/phpc_unserialize.c (lib/JIT/Builtin/StringUnserializeJit.php). This duplicates semantics in C, blocks self-host shrink, and risks VM/JIT drift on object refs, allowed_classes, and session decode paths.
php-src reference
Repro (JIT divergence probe)
<?php
$data = serialize(['a' => 1, 'b' => 2]);
echo unserialize($data)['b'], "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
php bin/jit.php repro.php
# JIT must match VM; today JIT uses __compiler_unserialize C helper
'
Scope (this repo)
| Layer |
Work |
| JIT |
Replace StringUnserializeJit C calls with call into compiled VmUnserializeFormat / shared PHP helper |
| AOT |
Same entry as JIT |
| C shrink |
Delete or bypass __compiler_unserialize / phpc_unserialize.c symbols when PHP path covers JIT builds |
| Tests |
Extend test/compliance/cases/stdlib/unserialize*.phpt with JIT rows |
Done when
Ref: #1492 · #5991 · #1175
Category
php-in-php· php-src-strict (runtime semantics from PHP VM path)Problem
unserialize()VM lowering uses PHP (ext/standard/VmUnserializeFormat.php), but JIT/AOT still emit native__compiler_unserializeLLVM cloned fromruntime/phpc_unserialize.c(lib/JIT/Builtin/StringUnserializeJit.php). This duplicates semantics in C, blocks self-host shrink, and risks VM/JIT drift on object refs,allowed_classes, and session decode paths.php-src reference
ext/standard/var_unserializer.c— reference behaviorext/standard/VmUnserializeFormat.php,ext/standard/unserialize.phpRepro (JIT divergence probe)
Scope (this repo)
StringUnserializeJitC calls with call into compiledVmUnserializeFormat/ shared PHP helper__compiler_unserialize/phpc_unserialize.csymbols when PHP path covers JIT buildstest/compliance/cases/stdlib/unserialize*.phptwith JIT rowsDone when
unserialize()results match VM on compliance vectors (scalars, arrays, allowed_classes subset)runtime/*.clogic — note lines removed from C in PR bodyscript/capability-matrix.phpnotes shared PHP loweringRef: #1492 · #5991 · #1175