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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ms419 at freezone dot co dot uk
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 12:01:28 2025 UTC