Category
language · php-src-strict
Problem
#9796 closed but VM still diverges from Zend on spaceship (<=>) for backed enum cases. Docker verification 2026-06-20:
| Expression |
Zend PHP 8.2 |
php bin/vm.php |
E::A <=> E::B (A=1, B=2) |
int(1) |
int(-1) ❌ |
E::A <=> 1 |
int(1) |
int(0) ❌ |
E::A <=> 'x' |
int(1) |
int(-1) ❌ |
Distinct from #9476 (LLVM migration): this is compare semantics in VM/JIT shared guards, not routing SpaceshipCompareJit to PHP.
php-src reference
Repro
test/repro/maintainer_spaceship_enum.php:
<?php
declare(strict_types=1);
enum E: int { case A = 1; case B = 2; }
var_dump(E::A <=> E::B);
var_dump(E::A <=> 1);
var_dump(E::A <=> 'x');
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_spaceship_enum.php
echo VM:
php bin/vm.php test/repro/maintainer_spaceship_enum.php
'
Scope
| Area |
Files |
| VM |
lib/VM/CompareSupport.php or enum compare path |
| JIT |
shared compare guards — must agree with VM |
| Tests |
test/compliance/cases/language/enum_spaceship.phpt |
Done when
Links
Category
language· php-src-strictProblem
#9796 closed but VM still diverges from Zend on spaceship (
<=>) for backed enum cases. Docker verification 2026-06-20:php bin/vm.phpE::A <=> E::B(A=1, B=2)int(1)int(-1)❌E::A <=> 1int(1)int(0)❌E::A <=> 'x'int(1)int(-1)❌Distinct from #9476 (LLVM migration): this is compare semantics in VM/JIT shared guards, not routing
SpaceshipCompareJitto PHP.php-src reference
Zend/zend_enum.c—zend_compare_enumZend/zend_operators.c—compare_functionspaceship dispatchRepro
test/repro/maintainer_spaceship_enum.php:Scope
lib/VM/CompareSupport.phpor enum compare pathtest/compliance/cases/language/enum_spaceship.phptDone when
var_dumplines match Zend output on VM./script/ci-fast.sh --filter enum_spaceshipgreenLinks