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

markus_petrux - April 9, 2009 - 07:14
Title:Bug when field shared» warning: array_combine(): Both parameters should have at least 1 element
Status:active» fixed

Oh, I see. Thanks for the report. Changing title to reflect the warning issued by PHP in this case. Fixed in CVS.

AttachmentSize
money-428208.patch 1.18 KB

#2

System Message - April 23, 2009 - 07:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.