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.
views_handler_field_field::post_execute(&$values), line 615-616 in 7x-3.x 6891ceb
When processing result $values for entities by type, the loop does not check if isset($object->{$this->aliases['entity_type']}) before using it to determine entity type.
This condition could occur if a style handler removes the fields in its implementation of the query() method to force a summary style view.
Comment | File | Size | Author |
---|---|---|---|
#13 | views-1591678-13.patch | 981 bytes | tim.plunkett |
#8 | 1591678-8.patch | 981 bytes | damiankloip |
#1 | views_handler_field_field--ensure-entity_type-isset-1591678.patch | 890 bytes | recrit |
Comments
Comment #1
recrit CreditAttribution: recrit commentedThe attached patch adds the check.
Comment #2
recrit CreditAttribution: recrit commentedComment #3
dawehnerThis patch looks fine, lets get it into 7.x-3.x and 8.x-3.x
Comment #4
ali_b CreditAttribution: ali_b commentedhm, after update, iam getting errors:
Notice: Undefined index: entity_type in views_handler_field_field->post_execute() (line 615 of .../sites/all/modules/views/modules/field/views_handler_field_field.inc).
Comment #5
somatics CreditAttribution: somatics commentedI'm getting floods of exactly the same error as #4 (down to the line# 615) on my site.
Comment #6
johnvSame error as #4 occurs, with -dev version from 29-05-2012.
IMO it needs an extra check:
if (isset($this->aliases['entity_type']) && ...
Comment #7
jddeli CreditAttribution: jddeli commentedSame error as #4
Comment #8
damiankloip CreditAttribution: damiankloip commentedI think @johnv is right. Unfortunately isset() can't check the existence of both at the same time.
Comment #9
akoepke CreditAttribution: akoepke commentedThis is still generating errors when I test it. It looks like these errors are because you are using || instead of &&.
In this first part of the condition it will still run isset($object->{$this->aliases['entity_type']}) even if $this->aliases['entity_type'] is not set. Even though the second check is done inside an isset that is checking $object and so the $this->aliases['entity_type'] reference still creates the notice.
Since the second condition requires the first to be true then using && seems to make sense.
Comment #10
jeffschulerThe change in #9 removes the notices for me.
Comment #11
tim.plunkettYep.
Comment #12
patoshi CreditAttribution: patoshi commented#8 + #9 solves the issue. its just a one line change with the addition of &&
screenshot http://img705.imageshack.us/img705/2301/croppercapture197.jpg
Comment #13
tim.plunkettOops, missed that this wasnt a finished patch.
Comment #14
damiankloip CreditAttribution: damiankloip commentedLooks good to me, apologies all for the flawed logic in #8 :)
Comment #15
Jawi CreditAttribution: Jawi commentedworks for me with views 7.x-3.3+169-dev
Comment #16
dawehnerThis looks perfect, thanks for the effort!
Committed to 7.x-3.x and 8.x-3.x