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
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:
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:
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 viaJSON_ERROR_*
constants. This error code seems to be internally recognized and supported (e.g. has a message) within PHP:php-src/ext/json/json.c
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:
php-src/ext/json/json.c
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 integer11
to handle this error case.--
Side note, it seems the
11
code is simply a result of that internalPHP_JSON_ERROR_NON_BACKED_ENUM
being the 12th item (thus 11 index) in this enum list:php-src/ext/json/php_json.h
Lines 42 to 56 in ec53e17
The text was updated successfully, but these errors were encountered: