[php-src] Issue #7778: Enum could not be converted to string with \array_intersect
| From: | damianwadley | Date: | Wed, 15 Dec 2021 09:29:47 +0000 |
| Subject: | [php-src] Issue #7778: Enum could not be converted to string with \array_intersect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238426@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7778
Comment Author: damianwadley
Related is that there was a [deliberate
decision](https://wiki.php.net/rfc/enumerations#auto-scalar_conversion) to not support automatically
converting _backed_ enums to their backed type for the time being. As mentioned, implementing that
will come in a future RFC after enums have settled into common usage.
> I think at this point we'd be better off adding a new
>
array_intersect alternative that uses strict comparison instead.
Sorting would still be required to reach O(n log n) efficiency that the various array comparison
functions offer. Using only equality would mean settling for the naive O(n^2) algorithm - which
could also be trivially implemented in userland if there was a need to work with arrays containing
unsortable items like enums.
Now, what to do with this issue? I'm not sure. On the old tracker I'd resolve as
Suspended, but those did have a tendency to get lost and forgotten over time. At the very least this
isn't actionable now or in the foreseeable future, and there is the fact that array_intersect
and enums are actually behaving as intended...