|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #29972 array_combine issues warning on empty arrays
Submitted: 2004-09-03 18:48 UTC Modified: 2005-04-11 10:03 UTC
From: sean at acidreign dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 5.0.1 OS: all
Private report: No CVE-ID:
 [2004-09-03 18:48 UTC] sean at acidreign dot net
array_combine issues a warning when empty arrays are passed as arguments, I submit that empty arrays should be valid input for this function, and the result should also be an empty array (rather than FALSE and a warning).

On top of that, the warning is non-sensical, as it states that  "Both parameters should have number of elements at least 0"

Reproduce code:
$a = array();
$b = array();
$c = array_combine( $a, $b );
var_dump( $c );

Expected result:
array(0) { }

Actual result:
Warning: array_combine() [function.array-combine]: Both parameters should have number of elements at least 0 in /var/www/vhosts/.../test.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-11 10:03 UTC]
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
Thank you for the report, and for helping us make PHP better.

the message is now ok
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Tue Oct 13 18:01:32 2015 UTC