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

From: Date: Wed, 23 Jul 2008 16:27:54 +0000
Subject: #45605 [Ana->Csd]: array_uintersect_assoc gives incorrect error message
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-127202@lists.php.net to get a copy of this message
 ID:               45605
 Updated by:       felipe@php.net
 Reported By:      ilewis at uk dot ibm dot com
-Status:           Analyzed
+Status:           Closed
 Bug Type:         Arrays related
 Operating System: fedora 8
 PHP Version:      5.3CVS-2008-07-23 (snap)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch.


Previous Comments:
------------------------------------------------------------------------

[2008-07-23 13:58:48] jani@php.net

php_array_intersect_key() should handle parameters the same way as
php_array_intersect() helper function does..

------------------------------------------------------------------------

[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



Thread (3 messages)

« previous php.bugs (#127202) next »