When saving a node with an empty Range field, I get the following error message:
Notice: Trying to access array offset on value of type null in Drupal\range\Plugin\Field\FieldWidget\RangeWidget->formElement() (line 151 of [...]/modules/contrib/range/src/Plugin/Field/FieldWidget/RangeWidget.php)
The error also occurs in line 152.
I am using Range 1.2 in Drupal 8.9.0 with PHP 7.4.6. The error does not occur in PHP 7.3, and it does not occur if I downgrade to Range 1.1.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | range-3150297-12.patch | 13.24 KB | taran2l |
| #12 | range-3150297-12-test-only.patch | 12.21 KB | taran2l |
Comments
Comment #2
david radcliffe commentedComment #3
taran2lhi @David Radcliffe - thanks or the issue but I'm not able to reproduce it... Could you provide more details?
Comment #4
david radcliffe commentedI was unable to reproduce the issue on a new Drupal site. Perhaps I forgot to run the update script.
Comment #5
david radcliffe commentedComment #6
hugronaphor commentedI do have the same issue and most likely the reason behind it is the fact that
.modulefile has only been added in 1.2 version.The issue is more about Drupal core, if you have a module enabled without a
.moduleadding it later won't be picked up by Drupal( see this discussion )I didn't find a solution through hook_update to this use-cases but there should be a way.
We need a programmatical fix instead of re-enabling the module as in my case I have lots of dependencies on this module and uninstalling it would cause more unwanted consequences.
Comment #7
gmarineau commentedI have the same issue any update or solution for this bug.
Comment #8
gmarineau commentedI have the same issue any update or solution for this bug.
Comment #9
john.oltman commentedSee attached patch for the fix. As noted previously, the notice only occurs in PHP 7.4 because of its stricter checking, although the logic involved was not ideal for any version. The prefix and suffix were added in 8.x-1.2 and therefore the bug only exists in that version.
Comment #10
john.oltman commentedComment #11
murzThanks for patch, it works well and fix the issue! Will be good to see it in module core!
Comment #12
taran2lHi everyone, thanks for pushing on this issue. In the end, I was able to reproduce the issue.
Test only patch is attached.
Comment #14
taran2l@john.oltman, your patch fixes the issue, but here is a more elegant/shorter approach
Comment #16
taran2lSo, HEAD now passes all tests, let's re-run the latest patch
Comment #17
taran2lComment #19
taran2l