Upgrading from 7.x-1.11 to 7.x-1.12 seems to have introduced this unwanted behaviour. I'm not sure if this is a PHP version issue or what, but the following line (244) seems to evaluate as true for my non-collection field:
if (isset($value['value']['value'])) { // Field collections have them nested.
My $value is technically a single-level array at this point (e.g. array('value' => 'DE')
). Unfortunately PHP is treating the 'value' string as an array for the purposes of isset()
, so isset($value['value']['value'])
evaluates as true (and $value['value']['value']
returns the first character of the string).
This can easily be fixed by restoring the is_array($value['value'])
checks from 7.x-1.11. I've taken this a bit further and streamlined the logic (all the Field Collection checks can be inside a single is_array()
check, and I've added an is_array($value)
wrapper around all the $value[*] checks because I'm pretty sure the same issue would crop up with a $value['value'] check against a string $value).
Comment | File | Size | Author |
---|---|---|---|
string-as-array.patch | 3.57 KB | kingandy | |
Comments
Comment #2
kingandy CreditAttribution: kingandy commentedI guess this should be Needs Review since there's a patch.
Comment #3
NWOM CreditAttribution: NWOM commentedThis no longer applies to the newest dev or stable. It appears to need a reroll, however maybe it is no longer needed either.