php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45605 array_uintersect_assoc gives incorrect error message
Submitted: 2008-07-23 12:45 UTC Modified: 2008-07-23 16:27 UTC
From: ilewis at uk dot ibm dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 5.3CVS-2008-07-23 (snap) OS: fedora 8
Private report: No CVE-ID: None
 [2008-07-23 12:45 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-23 13:58 UTC] jani@php.net
php_array_intersect_key() should handle parameters the same way as php_array_intersect() helper function does..
 [2008-07-23 16:27 UTC] felipe@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 18:01:31 2024 UTC