From: Operating system: Linux PHP version: 5.3.3 Package: Arrays related Bug Type: Bug Bug description:array_intersect_ukey does not check all keys
Description: ------------ The array_intersect_ukey() function appears to have an invalid algorithm for iterating over array keys to be passed to the user function. A simple test case that implements the same behavior as array_intersect_key() illustrates the bug. Test script: --------------- <?php function func($key1, $key2) { if ($key1 == $key2) { return 0; } return 1; } $all = array('cat' => 'brown', 'dog' => 'yellow', 'mouse' => 'grey', 'horse' => 'white' ); $keep = array('dog' => 1, 'horse' => 1); // Output of the following should be identical print_r(array_intersect_key($all, $keep)); print_r(array_intersect_ukey($all, $keep, 'func')); ?> Expected result: ---------------- Array ( [dog] => yellow [horse] => white ) Array ( [dog] => yellow [horse] => white ) Actual result: -------------- Array ( [dog] => yellow [horse] => white ) Array ( ) -- Edit bug report at http://bugs.php.net/bug.php?id=52867&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52867&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52867&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52867&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52867&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52867&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52867&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52867&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52867&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52867&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52867&r=support Expected behavior: http://bugs.php.net/fix.php?id=52867&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52867&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52867&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52867&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52867&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52867&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52867&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52867&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52867&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52867&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52867&r=mysqlcfg