Description
Description
When a non-backed enum is part of the data given to json_encode()
, an integer error code (11
) will be generated that is not currently available via JSON_ERROR_*
constants. This error code seems to be internally recognized and supported (e.g. has a message) within PHP:
Lines 190 to 191 in ec53e17
However, it seems that a public constant is not available as it is not currently included in the list of defined constants:
Lines 74 to 85 in ec53e17
My "feature request" is simply that this constant (JSON_ERROR_NON_BACKED_ENUM
?) be added so we do not have to rely on the integer 11
to handle this error case.
--
Side note, it seems the 11
code is simply a result of that internal PHP_JSON_ERROR_NON_BACKED_ENUM
being the 12th item (thus 11 index) in this enum list:
Lines 42 to 56 in ec53e17