Date: 09/14/01
- Next message: jeroen <email protected>: "[PHP-DEV] Bug #12528 Updated: array_unique function changed"
- Previous message: jeroen <email protected>: "[PHP-DEV] Bug #11893 Updated: array_intersect doesn't handle multidimensional arrays correctly"
- Next in thread: jeroen <email protected>: "[PHP-DEV] Bug #10891 Updated: array_unique does not work properly anymore"
- Maybe reply: jeroen <email protected>: "[PHP-DEV] Bug #10891 Updated: array_unique does not work properly anymore"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 10891
Updated by: jeroen
Reported By: kost <email protected>
Old Status: Open
Status: Bogus
Bug Type: Arrays related
Operating System: UNIX FreeBSD 4.1.1
PHP Version: 4.0.5
New Comment:
Array_unique isn't supposed to handle multi-dimension strings, nor objects.
See also 10658
Previous Comments:
------------------------------------------------------------------------
[2001-05-16 03:28:28] kost <email protected>
I've installed php 4.0.5 and function "array_unique" does not work correctly anymore.
The following code works with 4.0.3pl1 as it's supposed to do:
<?
$arr[0][] = 1;
$arr[0][] = 2;
$arr[0][] = 3;
$arr[1][] = 1;
$arr[1][] = 2;
$arr[1][] = 3;
$arr[2][] = 1;
$arr[2][] = 2;
$arr[2][] = 5;
$arr = array_unique($arr);
while(list(,$n) = each($arr)) echo implode(',',$n)."<br>";
?>
Output is :
1,2,3
1,2,5
But with php 4.0.5 it refuses to work and returns : 1,2,3
I've looked through source code "ext/standard/array.c" and revealed some differences between 4.0.3 - 4.0.5:
> set_compare_func(SORT_STRING); - 4.0.5
> set_compare_func(SORT_REGULAR); - 4.0.3
Some others functions array_* also use SORT_STRING comparing instead of SORT_REGULAR
Best regards,
Konstantin,
http://itc-ua.com
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=10891&edit=1
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: jeroen <email protected>: "[PHP-DEV] Bug #12528 Updated: array_unique function changed"
- Previous message: jeroen <email protected>: "[PHP-DEV] Bug #11893 Updated: array_intersect doesn't handle multidimensional arrays correctly"
- Next in thread: jeroen <email protected>: "[PHP-DEV] Bug #10891 Updated: array_unique does not work properly anymore"
- Maybe reply: jeroen <email protected>: "[PHP-DEV] Bug #10891 Updated: array_unique does not work properly anymore"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

