Category
language · php-src-strict · regression
Problem
Relational comparison between two cases of the same backed enum (<, <=>) must follow php-src declaration order. #9016 was closed 2026-06-16 but the repro still fails on VM (2026-06-17 audit): ordering is inverted for both int- and string-backed enums.
php-src reference
Repro
test/repro/issue_enum_relational_operators.php (in tree):
<?php
declare(strict_types=1);
enum E: int { case A = 1; case B = 2; }
enum S: string { case X = 'a'; case Y = 'b'; }
var_dump(E::A < E::B);
var_dump(E::A <=> E::B);
var_dump(S::X < S::Y);
var_dump(S::X <=> S::Y);
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/issue_enum_relational_operators.php
php bin/vm.php test/repro/issue_enum_relational_operators.php
'
| Expr |
Zend PHP 8.2 |
VM today |
E::A < E::B |
bool(false) |
bool(true) |
E::A <=> E::B |
int(1) |
int(-1) |
S::X < S::Y |
bool(false) |
bool(true) |
S::X <=> S::Y |
int(1) |
int(-1) |
Scope (this repo)
| Path |
Work |
lib/VM/EnumCaseSupport.php |
compareSpaceship() / relational lowering must match Zend ordinal, not inverted backing compare |
lib/VM/Variable.php |
enum case </> paths |
lib/JIT/ |
JIT/AOT spaceship/relational ops must agree with VM |
test/compliance/cases/language/enum_relational_operators.phpt |
guard repro |
PHP-in-PHP — no new runtime/*.c logic.
Done when
Related
Category
language· php-src-strict · regressionProblem
Relational comparison between two cases of the same backed enum (
<,<=>) must follow php-src declaration order. #9016 was closed 2026-06-16 but the repro still fails on VM (2026-06-17 audit): ordering is inverted for both int- and string-backed enums.php-src reference
Zend/zend_enum.c—zend_compare_enum, case orderingZend/zend_operators.c— relational ops on enum objectsRepro
test/repro/issue_enum_relational_operators.php(in tree):E::A < E::Bbool(false)bool(true)E::A <=> E::Bint(1)int(-1)S::X < S::Ybool(false)bool(true)S::X <=> S::Yint(1)int(-1)Scope (this repo)
lib/VM/EnumCaseSupport.phpcompareSpaceship()/ relational lowering must match Zend ordinal, not inverted backing comparelib/VM/Variable.php</>pathslib/JIT/test/compliance/cases/language/enum_relational_operators.phptPHP-in-PHP — no new
runtime/*.clogic.Done when
Related