-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression. Nested arrays throws array to string conversion in array_unique() #1561
Comments
The functions like array_unique work by converting all the items in them to strings then comparing, so an array to string notice is thrown. The notice isn't thrown in this exact case by Zend since it looks like it special cases a singleton array as an argument. |
Actually, they don't special case it. This comes down to implementation differences. Zend does the conversion to string each time it does a compare. HHVM starts by converting everything to a string, then comparing. So if there's multiple arrays, Zend throws a lot more warnings than HHVM. |
@simonwelsh I don't know what are you trying to explain but the expected behavior (no notices) is the current Zend behavior and 2.3.2 behavior. |
Thanks for reporting this. @simonwelsh is correct. I don't think we would want take the performance hit of repeated conversions to prevent the warning; this is a case where a PHP spec would help disambiguate what is contractual behavior and what is an implementation detail. The warning is being raised for a reason: you are passing an array element inside an argument to |
This is a recent regression. This works good in 2.3.2 but not in master
The text was updated successfully, but these errors were encountered: