Repeatable: Always
Steps to repeat:
1. Create two Content types for example A and B with each one relation select field, using the correct relation type
2. Create some content
Expected Results:
no errors
Actual Results:
If I create a new content the following error appears:
Notice: Undefined offset: 0 in _relation_select_field_widget_form() (Zeile 546 von /var/www/drupal_sites/opacc.ch/sites/all/modules/contrib/relation_select/relation_select.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | relation_select-undefined_index-1803408-8.patch | 756 bytes | steveoliver |
| #7 | relation_select-undefined_index-1803408-7.patch | 699 bytes | robertom |
| #6 | relation_select-undefined_index-1803408-6.patch | 697 bytes | robertom |
| #4 | relation_select-undefined_index-1803408-4.patch | 697 bytes | robertom |
Comments
Comment #1
fozzy commentedSubscribing
Comment #2
steveoliver commentedFixed in 37b291c. Thanks, daniela.
Comment #3
fozzy commentedThanks for the patch. I applied it and the Undefined offset message disappeared.
Unfortunately I'm getting now the following message : Undefined index: entity_id in _relation_select_field_widget_form() (line 550 of relation_select.module).
Obviously related to the patch...
Comment #4
robertom commentedSorry for my bad english.
After updated to last git version, I have: Undefined index: entity_id in _relation_select_field_widget_form()
I would propose a patch that has implicit is_object and is_array
Comment #5
fozzy commentedPatch #4 applied. Looks ok.
Thanks
Comment #6
robertom commentedreroll patch #4
Comment #7
robertom commentedreroll patch #6
Comment #8
steveoliver commentedmaybe something like this would be a more proper check?
Comment #9
robertom commentedSorry for my bad english
If
isset($items[$delta]->rid)is true$items[$delta]must be an objectand
if
isset($items[$delta]['relation_id']is true$items[$delta]must be an arrayI think additional check is redundant, but the fix will work well also with extra check... so you could commit what you prefer ;)
Comment #10
steveoliver commentedI was thinking we may get "Trying to get property of non-object" errors in the case where
$items[$delta]is an array. But you're right, isset won't throw that error -- but calling the property without checking *would* (as you pointed out in #4) :)Committed #7 in 559ec71.
Thanks, @robertom.