Hi

I get this error message when I am adding a new field of type video_upload to a content type.
I see the following lines of code at this location. Any idea as to what could be causing this error?

// @fixme - This need to be reviewed. The reason this is required
// is that the Drupal Form API doesn't allow js to change
// the values of hidden variables, so it must be done here.
// Supposedly it is dangerous to do so, thus the need for a
// review.
foreach ($_POST[$field_name] as $key => $item) {
if ($_POST[$field_name][$key]['id']) {
$node->{$field_name}[$key]['id'] = $_POST[$field_name][$key]['id'];
$items[$key]['id'] = $node->{$field_name}[$key]['id'];
}
}

Thanks
Krishna

Comments

kkrgopalan’s picture

Sorry for replying to my previous post

I added the following and it seems to fix the error but I am not sure if it has any other impacts
if (is_array($_POST[$field_name]))

// @fixme - This need to be reviewed. The reason this is required
// is that the Drupal Form API doesn't allow js to change
// the values of hidden variables, so it must be done here.
// Supposedly it is dangerous to do so, thus the need for a
// review.
if (is_array($_POST[$field_name]))
foreach ($_POST[$field_name] as $key => $item) {
if ($_POST[$field_name][$key]['id']) {
$node->{$field_name}[$key]['id'] = $_POST[$field_name][$key]['id'];
$items[$key]['id'] = $node->{$field_name}[$key]['id'];
}
}

jhedstrom’s picture

That fix should work fine. I'll try and get this committed to CVS soon. Thanks.

kkrgopalan’s picture

Thank you! Appreciate the prompt response.

jhedstrom’s picture

Status: Active » Fixed

This has been fixed in the 5.x dev branch.

Status: Fixed » Closed (fixed)

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