I got this error message in log after I received report error from my user, user got the unexpected error on screen when she is saving node

Notice: Undefined offset: 0 in weight_field_widget_form() (line 73 of /home/aaa/public_html/sites/all/modules/weight/weight.module).

CommentFileSizeAuthor
#3 3359734-unexpected-error-when.patch436 bytesozicon

Issue fork weight-3359734

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

freelylw created an issue. See original summary.

freelylw’s picture

any suggestion for how to solve this ?

ozicon’s picture

Check if default value is not null

argiepiano’s picture

This warning is a regression introduced by this commit, as part of this issue.

The problem here happens in the Manage field UI, when adding a new weight field. When you add a new field, weight_field_widget_form() receives an empty array in the $items parameters. The new (faulty) code added in the commit above doesn't check to see if the key provided by the variable $delta exists.

argiepiano’s picture

The patch in #3 doesn't solve the warning. It does set the default value to 0, which is needed, but the warning persists.

argiepiano’s picture

Title: unexpected error when saving node » Notice: Undefined offset: 0 in weight_field_widget_form()

argiepiano’s picture

I've submitted a merge request. Sorry, I haven't done patches and requests for Drupal for a few years, and I think the workflow is now different. Apologies if this was not done correctly.

argiepiano changed the visibility of the branch 7.x-3.x to hidden.

argiepiano changed the visibility of the branch 7.x-3.x to active.