php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48115 array_unique() drops int(0)
Submitted: 2009-04-29 21:50 UTC Modified: 2009-04-30 08:26 UTC
From: ms419 at freezone dot co dot uk Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2CVS-2009-04-29 (snap) OS: Debian
Private report: No CVE-ID: None
 [2009-04-29 21:50 UTC] ms419 at freezone dot co dot uk
Description:
------------
array_unique() on an array with strings and the value int(0) drops int(0)

or if int(0) comes first, it drops the first string

Reproduce code:
---------------
jablko@tad:~/php5.2-200904292030$ sapi/cli/php -r 'var_dump(array_unique(array("foo", 0)));'
array(1) {
  [0]=>
  string(3) "foo"
}
jablko@tad:~/php5.2-200904292030$ 

Expected result:
----------------
array(2) {
  [0]=>
  string(3) "foo"
  [1]=>
  int(0)
}

Actual result:
--------------
array(1) {
  [0]=>
  string(3) "foo"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-30 08:26 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #47370
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 07:01:29 2024 UTC