Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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).
Comment | File | Size | Author |
---|---|---|---|
#3 | 3359734-unexpected-error-when.patch | 436 bytes | ozicon |
Issue fork weight-3359734
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:
Comments
Comment #2
freelylw CreditAttribution: freelylw commentedany suggestion for how to solve this ?
Comment #3
ozicon CreditAttribution: ozicon commentedCheck if default value is not null
Comment #4
argiepiano CreditAttribution: argiepiano as a volunteer commentedThis 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.
Comment #5
argiepiano CreditAttribution: argiepiano as a volunteer commentedThe patch in #3 doesn't solve the warning. It does set the default value to 0, which is needed, but the warning persists.
Comment #6
argiepiano CreditAttribution: argiepiano as a volunteer commentedComment #13
argiepiano CreditAttribution: argiepiano as a volunteer commentedI'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.