Bug #66330 [NEW]: array_unique() sort problems
| From: | nomail at nomail dot de | Date: | Fri, 20 Dec 2013 14:05:02 +0000 |
| Subject: | Bug #66330 [NEW]: array_unique() sort problems | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183418@lists.php.net to get a copy of this message | ||
From: nomail at nomail dot de
Operating system: Windows
PHP version: Irrelevant
Package: Arrays related
Bug Type: Bug
Bug description:array_unique() sort problems
Description:
------------
The Sort_Flags are not realy working. Only SORT_NUMERIC and this on a
unexpected way, it loose some values.
Your menu to select my phpversion has not my Version includet, so my
Version is: 5.4.7
Test script:
---------------
$ar =
array('rot','gelb','grün','rot','234fw343','blau','gold');
$ar1 = array_unique($ar);
$ar2 = array_unique($ar,SORT_REGULAR);
$ar3 = array_unique($ar,SORT_NUMERIC);
$ar4 = array_unique($ar,SORT_STRING);
$ar5 = array_unique($ar,SORT_LOCALE_STRING);
print_r($ar1);
print_r($ar2);
print_r($ar3);
print_r($ar4);
print_r($ar5);
Expected result:
----------------
### Output ####
##### NOT EXPECTED, this is the unexpected Output #####
Array
(
[0] => rot
[1] => gelb
[2] => grün
[4] => 234fw343
[5] => blau
[6] => gold
)
Array
(
[0] => rot
[1] => gelb
[2] => grün
[4] => 234fw343
[5] => blau
[6] => gold
)
Array
(
[0] => rot
[4] => 234fw343
)
Array
(
[0] => rot
[1] => gelb
[2] => grün
[4] => 234fw343
[5] => blau
[6] => gold
)
Array
(
[0] => rot
[1] => gelb
[2] => grün
[4] => 234fw343
[5] => blau
[6] => gold
)
--
Edit bug report at https://bugs.php.net/bug.php?id=66330&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66330&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66330&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66330&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66330&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66330&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66330&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66330&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66330&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66330&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66330&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66330&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66330&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66330&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66330&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66330&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66330&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66330&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66330&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66330&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66330&r=mysqlcfg