#45605 [Opn->Ana]: array_uintersect_assoc gives incorrect error message

From: Date: Wed, 23 Jul 2008 13:58:49 +0000
Subject: #45605 [Opn->Ana]: array_uintersect_assoc gives incorrect error message
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127196@lists.php.net to get a copy of this message
ID: 45605 Updated by: jani@php.net Reported By: ilewis at uk dot ibm dot com -Status: Open +Status: Analyzed Bug Type: Arrays related Operating System: fedora 8 PHP Version: 5.3CVS-2008-07-23 (snap) New Comment: php_array_intersect_key() should handle parameters the same way as php_array_intersect() helper function does.. Previous Comments: ------------------------------------------------------------------------ [2008-07-23 12:45:58] ilewis at uk dot ibm dot com Description: ------------ If you run array_uintersect_assoc and give it an invalid callback for the third argument, you get two error messages. The second one is unnecessary, but it is also wrong as it tells you that you need to pass 3 parameters and that you've actually passed 3. I've written a patch for array.c to fix it which I've put on pastebin: http://pastebin.com/m49c46604 Reproduce code: --------------- <?php var_dump(array_uintersect_assoc(array(1), array(1), array(1))); ?> Expected result: ---------------- Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in Command line code on line 1 NULL Actual result: -------------- Warning: array_uintersect_assoc() expects parameter 3 to be a valid callback, array must have exactly two members in Command line code on line 1 Warning: array_uintersect_assoc(): at least 3 parameters are required, 3 given in Command line code on line 1 NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45605&edit=1

« previous php.bugs (#127196) next »