Doc #69059 [NEW]: array_udiff logical bug

From: Date: Mon, 16 Feb 2015 01:03:05 +0000
Subject: Doc #69059 [NEW]: array_udiff logical bug
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11947@lists.php.net to get a copy of this message
From: geoleu11 at gmail dot com Operating system: Ubuntu PHP version: Irrelevant Package: *General Issues Bug Type: Documentation Problem Bug description:array_udiff logical bug Description: ------------ --- From manual page: http://www.php.net/function.array-udiff --- Since the information that can be selected for providing php version information, here is some info about the build : PHP Version 5.5.9-1ubuntu4.5 . Also regarding the problem/bug source : array function, more specifically : array_udiff . The output of the below script is : array (size=1) 0 => string 'red' (length=3) Why does array_udiff return a common element from those arrays? Shouldn't it return the elements are present in the first array and not in the other arrays? At least if you try internal array_diff, it does return the proper value from those 2 arrays below . Test script: --------------- $a1 = array('red'); $a2 = array('red', 'blue'); $diff = array_udiff($a1, $a2, function($a, $b) { if($a === $b) { return 0; } else { return -1; } }); var_dump($diff); Expected result: ---------------- The expected result should be an empty array. array (size=0) empty Actual result: -------------- array (size=1) 0 => string 'red' (length=3) -- Edit bug report at https://bugs.php.net/bug.php?id=69059&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69059&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69059&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69059&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69059&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69059&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69059&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69059&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69059&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69059&r=support Expected behavior: https://bugs.php.net/fix.php?id=69059&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69059&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69059&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69059&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69059&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69059&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69059&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69059&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69059&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69059&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69059&r=mysqlcfg

« previous php.doc.bugs (#11947) next »