Repository navigation
Closed
Labels
IMPORTANTCritical pathCritical patharea:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language features
Description
Category
language · php-src-strict
Problem
PHP 8.4 clone($object, ['prop', ...]) (clone-with) lets callers reinitialize selected properties on a cloned object — notably readonly properties that would otherwise stay frozen after clone.
This compiler already has runtime support (lib/VM/CloneWithSupport.php, lib/JIT/Builtin/CloneWithReinitRuntime.php, ext/standard/CloneWithJitHelper.php, issue #9717 for AOT LLVM routing), but the parser rejects the syntax before compile:
Syntax error, unexpected ',' on line N
Workers cannot exercise clone-with end-to-end until parse + compile lowering accept the second argument.
php-src reference
- php/php-src
Zend/zend_language_parser.y—clone_exprwith optional property list - php/php-src
Zend/zend_compile.c—zend_compile_clone()property reinit list - php/php-src
Zend/zend_objects.c—zend_objects_clone_obj_with()/IS_PROP_REINITABLE
Repro (failure today)
Save as test/repro/maintainer_gap_clone_with_syntax.php:
<?php
declare(strict_types=1);
class W {
public int $a = 1;
public readonly int $b;
public function __construct() {
$this->b = 2;
}
}
$w = new W();
$w2 = clone($w, ['a']);
echo $w2->a, ',', $w2->b, "\n";php test/repro/maintainer_gap_clone_with_syntax.php
# Zend PHP 8.4+: 1,2 (readonly b copied; a reinitialized)
./script/docker-exec.sh php bin/vm.php test/repro/maintainer_gap_clone_with_syntax.php
# VM: PhpParser Syntax error, unexpected ',' — parse failsScope (PHP-in-PHP first)
| Path | Work |
|---|---|
vendor/nikic/php-parser / php-cfg overlay |
accept clone($x, ['prop']) AST node (may need grammar patch via patches/) |
lib/Compiler.php |
emit clone-with property list + hook existing CloneWithSupport |
lib/VM.php |
wire reinit window (already partially present) |
lib/JIT/ |
reuse CloneWithReinitRuntime / CloneWithJitHelper |
test/compliance/cases/language/clone_with_readonly.phpt |
readonly reinit parity |
Do not add new C in runtime/ — reuse existing PHP helpers (#9717).
Done when
- Repro compiles and prints
1,2on VM (php-src-strict) - Readonly property outside clone-with list stays immutable after clone
-
./script/ci-fast.sh --filter clone_withgreen - JIT/AOT agree when both in scope (reuse php-in-php: AOT CloneWithReinitRuntimeLlvm — route standalone clone-with reinit through CloneWithJitHelper PHP (#1492) #9717 helper path)
Related
- php-in-php: AOT CloneWithReinitRuntimeLlvm — route standalone clone-with reinit through CloneWithJitHelper PHP (#1492) #9717 — AOT standalone LLVM → PHP helper routing (runtime half)
- Language: clone with — readonly property overrides must succeed during reinit window (zend_objects_clone_obj_with) #7250 — readonly reinit window semantics
- North star Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492
Metadata
Metadata
Assignees
Labels
IMPORTANTCritical pathCritical patharea:compilerCompiler / CFG / JITCompiler / CFG / JITarea:vmVirtual machineVirtual machineenhancementNew feature or requestNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimSpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language featuresPhase 2 – language features
Activity
PurHur commentedon Jun 18, 2026
claim: worker-lane-b — starting this run
PurHur commentedon Jun 18, 2026
Merged via #9757.
Verification:
Repro prints
1,2; unit + VM compliance green.Desugar PHP 8.4 clone($obj, [...]) syntax via CloneWithDesugar (#9743)…