warning: array_combine(): Both parameters should have at least 1 element
sinasquax - April 8, 2009 - 20:54
| Project: | Money CCK field |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I use a money field in a content type that i want to share on another content type but when i add existing money field, i have got some warning, this is the code which cause the problem :
<?php
$allowed_currencies = array_keys(array_filter($widget['allowed_currencies']));
$allowed_currencies = array_combine($allowed_currencies, $allowed_currencies);
?>And i fixed the bug with this code :
<?php
if (isset($widget['allowed_currencies']) && is_array($widget['allowed_currencies'])) {
// Get filtered array
$allowed_currencies = array_filter($widget['allowed_currencies']);
// If not empty, create array for form elements
if (!(empty($allowed_currencies))) {
$allowed_currencies = array_keys($allowed_currencies);
$allowed_currencies = array_combine($allowed_currencies, $allowed_currencies);
}
}
?>
#1
Oh, I see. Thanks for the report. Changing title to reflect the warning issued by PHP in this case. Fixed in CVS.
#2
Automatically closed -- issue fixed for 2 weeks with no activity.