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.
Notice: Trying to access array offset on value of type null in image_field_views_data_views_data_alter() line 44, line 56, 57
Comment | File | Size | Author |
---|---|---|---|
#9 | views-image_php74-3211785-8.patch | 2.92 KB | jenlampton |
| |||
#2 | views-3211785.patch | 1.13 KB | alin_cut |
|
Issue fork views-3211785
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
alin_cut CreditAttribution: alin_cut commentedComment #3
DamienMcKennaSorry, but that's not how you should handle it, isset() returns a boolean whereas those variables expect a string.
Could you please explain what triggered the problem? What version of PHP are you using? What sort of data are you viewing? Could you please export the view and paste it here so we can review it? Thank you.
Comment #4
VladimirAusClearing cache from Performance page on
PHP 7.4.15
.After applying patch from #3153312: PHP 7.4 warnings with disabled Comment module the following errors still exist
Comment #5
tonysbag CreditAttribution: tonysbag as a volunteer commentedSame errors when we upgrade php to version 7.4 from 7.3. I got these errors after i cleared cache.
I think "Trying to access array offset on value of type null" is the only problem we need to solve it.
I dont know much about coding but maybe we should do some coding like check if the value is set.
Thank you!
Comment #6
kevster CreditAttribution: kevster commentedIm seeing this too on latest views but its field not image - Drupal 7.81, PHP 7.4.20
Notice: Trying to access array offset on value of type null in field_views_field_default_views_data() (line 123 of .../sites/all/modules/views/modules/field.views.inc).
Comment #7
percoction CreditAttribution: percoction commentedMade a separate issue here with a patch for the bug mentioned in #6
https://www.drupal.org/project/views/issues/3225149
Comment #8
DamienMcKennaThese changes are incorrect and will break things, e.g.:
That's supposed to store a string but you're changing it to a boolean. All of the changes made are like that, i.e. they're all incorrect.
The bigger issue is why $entity_info is empty in the first place.
Comment #9
jenlamptonHere's a safer patch that checks for
$entity_info
before using it to build the$data
array.> The bigger issue is why $entity_info is empty in the first place.
This site is using the profile2 module and the profile has an image field. Here,
'profile2'
appears in$bundles
as an entity type (its bundle is listed as'main'
), but that doesn't have any entity info.I agree that this is more likely an issue with Profile2, but I'll just fix up this patch on my way over there...
This article might also be useful for some who land here:
Data fix: Field [field] refers to nonexistent entity type [type].
(check your logs to see if you have this error)
Comment #10
VladimirAusThat worked on PHP 7.4 both locally and on Acquia.
Thanks.
Comment #11
DamienMcKennaSeems like a minor thing, it probably is a bug in another module, but I don't see any harm in the change. Thanks JenLampton.