You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
json_encode() on enum case operands must match Zend/php-src JSON serialization rules. Today the VM path fails in VmJson::export() with a generic LogicException before JSON is produced.
Strictness: php-src-strict — match ext/json/php_json.c enum handling.
php-src reference
ext/json/php_json.c — php_json_encode() / enum case handling
Zend/zend_enum.c — backed vs unit enum JSON representation
Summary
json_encode()on enum case operands must match Zend/php-src JSON serialization rules. Today the VM path fails inVmJson::export()with a genericLogicExceptionbefore JSON is produced.Strictness: php-src-strict — match
ext/json/php_json.cenum handling.php-src reference
ext/json/php_json.c—php_json_encode()/ enum case handlingZend/zend_enum.c— backed vs unit enum JSON representationRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/parity_json_encode_enum.php'Compare with Zend in the same container:
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php test/repro-maintainer/parity_json_encode_enum.php'Zend PHP 8.2 (expected):
php-compiler VM (actual):
Expected behavior
""(empty JSON string)stringcase"x"intcase1Implementation hints (PHP-in-PHP)
ext/standard/VmJson.php::export()forVariable::TYPE_ENUM_CASE.ext/standard/json_encode.phpJIT lowering..phptundertest/compliance/cases/stdlib/+ JIT/AOT fixtures.runtime/.Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter json_encode_enum test/compliance/'Maintainer repro:
test/repro-maintainer/parity_json_encode_enum.phpCategory
php-in-php|stdlibDone when
test/repro-maintainer/parity_json_encode_enum.phpprints unit"", backed string"x", backed int1on VM — matching Zend side-by-side in DockerVmJson::export()handlesTYPE_ENUM_CASE; no LogicException abort on enum operandsjson_encode()JIT lowering mirrors VM rules (or documents VM-only v1 in capability matrix)json_encode_enumfilter green; enum-case TypeError cases where php-src rejects operands