[php-src] Issue #7778: Enum could not be converted to string with \array_intersect
| From: | iluuu1994 | Date: | Wed, 15 Dec 2021 08:55:59 +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-238424@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7778
Comment Author: iluuu1994
That comes down to how
array_intersect works.
https://www.php.net/manual/en/function.array-intersect.php
> **Note**: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2.
> In words: when the string representation is the same.
array_intersect will also not work for other objects that don't implement
__toString and it might unintentionally match objects that coincidentally return the
same string. I think at this point we'd be better off adding a new array_intersect
alternative that uses strict comparison instead.
Any change here will likely require an RFC.