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.
Happens a lot on admin/build/features/manage
Comment | File | Size | Author |
---|---|---|---|
#5 | features-1515878-5-strict-warning.patch | 1.45 KB | mikeytown2 |
#1 | features-1515878-1-strict-warning.patch | 1.47 KB | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedComment #2
hefox CreditAttribution: hefox commentedDon't have strict enabed
Would reset be better here?
Is this unset really worth it? If continue with the array_shift instead of reset, it's just an empty array leftover. It's fairly non-standard to do, tmk.
Unrelated white space
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedWhite space fixes happen automatically by my editor.
If an empty array is all that is left (array that has one value), why not access the existing instance via the known key; or are the keys unknown (why not use key() then)? I did an unset because we don't use the variable after extracting what we want from it; I didn't know the size of whats left thus the use of unset to make sure memory usage doesn't get out of control.
Use this on your dev environment.
Comment #4
hefox CreditAttribution: hefox commentedNeed to fix the whitespace in features, but coding standard issues should generally not be part of an unrelated patch.
The function should only be returning an array with one item given the parameters sent to it (there should only be one field per field_name/type), so just need to get that one element in that array, thus array_shift leaves an empty array when it's done.
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedHere's a patch without unset.
Comment #6
hefox CreditAttribution: hefox commentedThanks