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 :


$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 :


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);
  }
}

CommentFileSizeAuthor
#1 money-428208.patch1.18 KBmarkus_petrux

Comments

markus_petrux’s picture

Title: Bug when field shared » warning: array_combine(): Both parameters should have at least 1 element
Status: Active » Fixed
StatusFileSize
new1.18 KB

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

Status: Fixed » Closed (fixed)

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