Hello! I worked on own module base on Link Module and using Editablefields Module's functionality.
When I click 'Save' button I see (see screenshot in attachmets):

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: Recoverable fatal error: Argument 1 passed to drupal_array_get_nested_value() must be an array, boolean given, called in Z:\home\localhost\drupal7\sites\all\modules\editablefields\editablefields.module on line 315 and defined in drupal_array_get_nested_value() (line 6508 of Z:\home\localhost\drupal7\includes\common.inc).

I think need modify code in editablefields.module, line 315:

$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);

Need Changed to:

if(isset($form_state['edit_mode'])) {
    if(!is_array($form_state['edit_mode']) && !$form_state['edit_mode']) {
      $form_state['edit_mode'] = array();
    }
    $edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
  } else {
    $edit_mode_state = FALSE;
  }

It need 'cause $form_state['edit_mode'] can contain an empty string, but first argument for drupal_array_get_nested_value should be an array.
Please, review!
Best regards,
Stanislav Potapenko

CommentFileSizeAuthor
editables_bug1.png88.03 KBskinpot
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

askibinski’s picture

Patch seems to work for me. Error is gone and field is saved.
Probably needs more testing and review though.

pcdesign’s picture

I also tried it, it seems to work form me...

SemasPing’s picture

Work for me too

allio_froggio’s picture

I patched but I still get the error. However, I get it when I use the "edit this field" button when the option "click to edit" is selected. Does the patch have to be applied elsewhere?

Also, and this could be unrelated completely, if I leave "click to edit" de-selected, the auto-complete fields do not function (no options are displayed). So, I can't add new values but, I don't get an error. It just doesn't work.

Thanks for any help! Happy Holidays!

j.c.gram’s picture

A potential simpler solution would be to change line 315 from:

$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);

to:

$edit_mode_state = isset($form_state['edit_mode']) && is_array($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);

This will also prevent the (albeit very slight) performance hit of running drupal_array_get_nested_value() when $form_state['edit_mode'] is not an array.

illmatix’s picture

#5 worked for me. So far no issues with it.

andreav’s picture

Just a feedback.

I'm on version = "7.x-1.0-alpha2+7-dev", code has slightly changed, cannot apply any patch.

The error now is about string parameter, no more boolean:
... Argument 1 passed to drupal_attributes() must be of the type array, string given ...

Sorry, I'm not able to adapt these patches to new code.

adshill’s picture

Patch in the post works for me.

Patch in #5 didn't work - works first save but further saves don't work.

noahadler’s picture

Original patch worked for me as well.

Kristen Pol’s picture

Status: Needs review » Needs work

Neither the original code from the issue summary or the code in #5 is working for me. I'm using the latest dev code.

Kristen Pol’s picture

Status: Needs work » Closed (fixed)

It turns out it was an issue with some other javascript clobbering this functionality. The latest dev version is working fine.

dags’s picture

Status: Closed (fixed) » Needs work

Was a fix for this ever actually committed? @Kristen Pol, were you saying that the latest dev works as is, or it works with the patch in #5 applied?

gswebmaster’s picture

I just added the fix to the latest release. It has not been committed.

artbussy’s picture

Maybe for other users: I installed the stable version today and it seems to work well with the patch from #5. Not without.

pringlz’s picture

Hi! I download alpha2 version yesterday and saw 315 error! stable version is not changed! For me worked fine code from header of post. Please, change stable version!

Jujens’s picture

Solution given in #5 worked for me.

nooysters’s picture

#5 fixed ajax errors for me too!

Feral’s picture

Still same problem

#5 didn't work.
Just latest dev version works.

pebosi’s picture

When using current Dev Version, try removing line 552:

 _field_invoke_default('extract_form_values', $element['#entity_type'], $entity, $form, $form_state);

Without this, no error occurs, and it still works for me.

Regards

pebosi’s picture

Status: Needs work » Needs review
mparker17’s picture

Status: Needs review » Closed (duplicate)

This issue is be a duplicate of #1206656: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value(), which is already in the 7.x-1.x-dev version. I've confirmed that running either the 7.x-1.x-dev version of the module, or applying the patch in #1206656-65: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value() works for me.

Lingaraj_M’s picture

@skinpot, Works for me

if(isset($form_state['edit_mode'])) {
if(!is_array($form_state['edit_mode']) && !$form_state['edit_mode']) {
$form_state['edit_mode'] = array();
}
$edit_mode_state = isset($form_state['edit_mode']) && drupal_array_get_nested_value($form_state['edit_mode'], $form['#parents']);
} else {
$edit_mode_state = FALSE;
}

drvdt’s picture

#19 and remove one more line below that line. Worked!
_field_invoke_default('extract_form_values', $element['#entity_type'], $entity, $form, $form_state);
_field_invoke('validate', $element['#entity_type'], $entity, $errors);