Category
stdlib | regression (re-#8962)
Problem
Zend ctype_*() returns false when the operand is an enum case object (not a string). This compiler coerces backed enum cases to their backing string and returns true — e.g. ctype_alpha(E::A) with E::A = 'abc' → true instead of false.
Issue #8962 was closed; repro still wrong on VM (verified 2026-06-16).
php-src reference
Repro
test/repro/maintainer_gap_ctype_enum.php:
<?php
enum E: string { case A = 'abc'; case B = '123'; }
var_dump(ctype_alpha(E::A));
var_dump(ctype_digit(E::B));
var_dump(ctype_alnum(E::A));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_gap_ctype_enum.php
php bin/vm.php test/repro/maintainer_gap_ctype_enum.php
'
| Call |
Zend PHP 8.x |
VM (2026-06-16) |
ctype_alpha(E::A) |
bool(false) |
bool(true) |
ctype_digit(E::B) |
bool(false) |
bool(true) |
ctype_alnum(E::A) |
bool(false) |
bool(true) |
Scope
ext/ctype/*.php VM handlers — reject enum case objects before backing coercion (shared guard like VmMath::rejectEnumCaseOperand)
ext/ctype/JitCtype*.php — match VM at JIT compile time when operand type is provably enum
- Registration:
ext/ctype/Module.php
Done when
Category
stdlib| regression (re-#8962)Problem
Zend
ctype_*()returnsfalsewhen the operand is an enum case object (not a string). This compiler coerces backed enum cases to their backing string and returnstrue— e.g.ctype_alpha(E::A)withE::A = 'abc'→trueinstead offalse.Issue #8962 was closed; repro still wrong on VM (verified 2026-06-16).
php-src reference
ext/standard/ctype.c—ctype_is_valid_strrejects non-string/non-int scalars; enum cases areIS_OBJECTRepro
test/repro/maintainer_gap_ctype_enum.php:ctype_alpha(E::A)bool(false)bool(true)ctype_digit(E::B)bool(false)bool(true)ctype_alnum(E::A)bool(false)bool(true)Scope
ext/ctype/*.phpVM handlers — reject enum case objects before backing coercion (shared guard likeVmMath::rejectEnumCaseOperand)ext/ctype/JitCtype*.php— match VM at JIT compile time when operand type is provably enumext/ctype/Module.phpDone when
test/compliance/cases/stdlib/ctype_enum_operand.phpt