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_validate() (PHP 8.3+) must reject non-string $json operands with catchable TypeError like Zend. VM accepts backed enum cases and coerces via backing scalar — repro prints uncaught instead of TypeError.
Independent of enum object materialization (#8746): even if enum cases were objects, json_validate(E::A) must still TypeError (php-src Z_PARAM_STR).
Category
stdlibProblem
json_validate()(PHP 8.3+) must reject non-string$jsonoperands with catchable TypeError like Zend. VM accepts backed enum cases and coerces via backing scalar — repro printsuncaughtinstead ofTypeError.Independent of enum object materialization (#8746): even if enum cases were objects,
json_validate(E::A)must still TypeError (php-srcZ_PARAM_STR).php-src reference
ext/json/php_json.c—php_json_validate()ext/standard/basic_functions.stub.php—json_validatesignatureRepro
test/repro/maintainer_gap_json_validate_enum.php:Zend PHP 8.3+:
TypeError: json_validate(): Argument #1 ($json) must be of type string, E givenVM today:
uncaughtScope
ext/standard/json_validate.php— VM path usesVmString::coerceStringBuiltinArg()(guard must run under php-src-strict)ext/standard/JitJsonValidate.php—JitStringBuiltinArg::lower()mirrorVmString::coerceStringBuiltinArg,RuntimeStrictness::enforceStringBuiltinParityGuards()Done when (php-src-strict)
#3101execute path enabled)test/compliance/cases/stdlib/json_validate_enum_typeerror.phptgreenLogicExceptionfor user type mistakes (Language: stdlib builtin LogicException type guards — must throw catchable TypeError for enum operands (zend_exceptions.c, phase 2 #4866) #6267)Links