php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63029 comparison error
Submitted: 2012-09-07 09:49 UTC Modified: 2012-09-07 10:03 UTC
From: svens94 at yahoo dot de Assigned:
Status: Not a bug Package: Arrays related
PHP Version: Irrelevant OS: Debian 6.0.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: svens94 at yahoo dot de
New email:
PHP Version: OS:

 

 [2012-09-07 09:49 UTC] svens94 at yahoo dot de
Description:
------------
---
From manual page: http://www.php.net/function.array-uintersect#refsect1-
function.array-uintersect-description
---
array_uintersect (and other intersect-functions with callback) maybe link wrong..
the callback get some data a second time or nothing
or it gets 2 from the same array


Test script:
---------------
function compTest($first, $second)
{
 echo "<br> first:".$first." second: ".$second;
 if($first == $second) return 0;
 return 1;
}

array_uintersect(range(1,3),range(1,3),"comptest");
<hr>
array_uintersect(range(1,2),range(4,5),"comptest");

Expected result:
----------------
1->1
1->2
1->3
and so on...
_____
1->4
1->5
2->4
2->5

Actual result:
--------------
first:2 second: 1
first:3 second: 2
first:2 second: 1
first:3 second: 2
first:1 second: 1
first:1 second: 2
first:2 second: 2
first:2 second: 3
first:3 second: 3
________
first:2 second: 1
first:5 second: 4
first:1 second: 4
first:1 second: 5

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-07 10:03 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 [2012-09-07 10:03 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

the internal implementation is correct.  you can refer to ext/array.c
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 10:01:38 2025 UTC