#51098 [Opn->Bgs]: Strange array_flip() type handling
| From: | martinkozak at martinkozak dot net | Date: | Sat, 20 Feb 2010 18:43:47 +0000 |
| Subject: | #51098 [Opn->Bgs]: Strange array_flip() type handling | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147895@lists.php.net to get a copy of this message | ||
ID: 51098
User updated by: martinkozak at martinkozak dot net
Reported By: martinkozak at martinkozak dot net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: FreeBSD 8.0
PHP Version: 5.2.12
New Comment:
Mistake.
Previous Comments:
------------------------------------------------------------------------
[2010-02-20 18:41:48] martinkozak at martinkozak dot net
Description:
------------
array_flip() converts some string values to integers (but some not) in
non-associative array and assigns strange values, not value appropriate
to last occurence.
Reproduce code:
---------------
---
From manual page: http://www.php.net/function.array-flip#Description
---
<?php
$foo = array(
'1',
'1',
'2̈́',
'2',
'2',
'2',
'3',
);
var_dump(array_flip($foo));
Expected result:
----------------
array(3) {
["1"]=>
int(1)
["2̈́"]=>
int(5)
["3"]=>
int(6)
}
Actual result:
--------------
array(4) {
[1]=>
int(1)
["2̈́"]=>
int(2)
[2]=>
int(5)
[3]=>
int(6)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=51098&edit=1