php.net |  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: None
 [2004-09-03 18:48 UTC] sean at acidreign dot net
Description:
------------
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
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-11 10:03 UTC] andrey@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.

the message is now ok
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 18:01:30 2024 UTC