From: lig at maolek dot com Operating system: Windows XP SP2 PHP version: 5.1.4 PHP Bug Type: Arrays related Bug description: Wrong output for function array_diff_ukey
Description: ------------ unexpected output. Accourding to docs array_diff_ukey "returns an array containing all the values of array1 that have keys that are not present in any of the other arguments". A key that is present in both $array1 and $array2 is showing up in the output. It should be noted that the values of the keys are different, but the example provided in the doc page has the same situation and the key isn't in the output. Reproduce code: --------------- function key_compare_func($a, $b) { if ($a === $b) { return 0; } return ($a > $b)? 1:-1; } $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red", ""); $array2 = array("a" => "green", "yellow", "red", TRUE); $array3 = array("red", "a"=>"brown", ""); $result[] = array_diff_ukey($array1, $array3, "key_compare_func"); $result[] = array_diff_ukey($array2, $array3, "key_compare_func"); print_r($result); Expected result: ---------------- Array ( [0] => Array ( [b] => brown [c] => blue ) [1] => Array ( [2] => 1 ) ) Actual result: -------------- Array ( [0] => Array ( [a] => green [b] => brown [c] => blue ) [1] => Array ( [a] => green [2] => 1 ) ) -- Edit bug report at http://bugs.php.net/?id=37573&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37573&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37573&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37573&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37573&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37573&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37573&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37573&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37573&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37573&r=support Expected behavior: http://bugs.php.net/fix.php?id=37573&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37573&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37573&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37573&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37573&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37573&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37573&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37573&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37573&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37573&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37573&r=mysqlcfg