php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63787 Array_unique notice (array to string conversion)
Submitted: 2012-12-17 12:04 UTC Modified: 2013-01-16 15:10 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: enumag at gmail dot com Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.4.9 OS: any
Private report: No CVE-ID: None
 [2012-12-17 12:04 UTC] enumag at gmail dot com
Description:
------------
If array_unique gets an array of arrays as it's parameter and a custom $sort_flag is not provided, it throws this error (array to string conversion). The reason is obvious, any value is changed to a string and then compared. The problem is that it took me quite some time to figure it out and a less experienced programmer is totally clueless.

Not sure if this can be fixed in PHP without BC break but at the very least it could be mentioned in documentation of array_unique function.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-16 15:10 UTC] googleguy@php.net
-Status: Open +Status: Not a bug
 [2013-01-16 15:10 UTC] googleguy@php.net
This is already mentioned in the documentation under http://us1.php.net/array-
unique#refsect1-function.array-unique-notes

See note for:

"Note: Note that array_unique() is not intended to work on multi dimensional 
arrays."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 07:01:30 2024 UTC