Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Bug #9983 Function [array_udiff_uassoc()] is incorrectly implemented
Submitted: 2007-01-30 23:01 UTC
From: teague dot costas at amd dot com Assigned: arpad
Status: Closed Package: PHP_Compat (version 1.5.0)
PHP Version: 4.3.9 OS: Linux
Roadmaps: 1.6.0a1    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2007-04-06 17:27 UTC
Package:
Bug Type:
Summary:
From: teague dot costas at amd dot com
New email:
PHP Version: Package Version: OS:

 

 [2007-01-30 23:01 UTC] teague dot costas at amd dot com (Teague Costas)
Description: ------------ The function [ array_udiff_uassoc() ] is incorrectly implemented. That is, it's the wrong function. The code is identical to the code for [ array_udiff_assoc() ] (note the missing "u"), which is a different function. The PHP documentation will reveal the major difference--namely, that the [ uassoc ] version takes *two* callbacks: one for keys, one for values. PHP_Compat's version, however, takes only one--which is incorrect. The given code (it's only one line) will cause the function to generate an "Argument #3 is not an array" error. (If the function [ compareArrayKeys() ] doesn't exist Test script: --------------- function compareArrayKeys($a, $b) { return 0; } function compareArrayValues($a, $b) { return 0; } array_udiff_uassoc(array(), array(), 'compareArrayValues', 'compareArrayKeys'); Expected result: ---------------- I expected to not get any warnings, and I expected the function to implement PHP5's [ array_udiff_uassoc() ]. Actual result: -------------- Warning: array_udiff_uassoc() Argument #3 is not an array in /<...>/include/php/pear/PHP/Compat/Function/array_udiff_uassoc.php on line 56

Comments

 [2007-04-06 17:27 UTC] arpad (Arpad Ray)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.