Hi all,
recently through Máté, I discovered that Backed Enum behaviour was changed
for http_build_query in PHP8.4 see the github PR
https://github.com/php/php-src/issues/15650
This change was never discussed on the mailing list and seems to have been
prompt to align with a SOAP client serialization fix and to align with how
BackedEnum are serialized
using json_encode.

Now I believe the PHP does some serialization elsewhere for instance when
using fputcsv. My question is should Backed Enum also be handled
differently in case of fputcsv ?

IMHO if we want consistency in the PHP language the answer should be yes
and have BackedEnum converted to their value (string
or int) before serialization. Either way I believe a discussion about it
should take place. My goal would be to have a clear rule on how Backed Enum
is serialized across PHP regardless
of the feature. I have not made any attempt at screening or searching for
all serialization mechanisms in PHP but I presume they should all be listed
and updated to follow the same rule
for consistency.

Best regards,
Ignace

Reply via email to