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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

recrit’s picture

The attached patch adds the check.

recrit’s picture

Status: Active » Needs review
dawehner’s picture

Status: Needs review » Fixed

This patch looks fine, lets get it into 7.x-3.x and 8.x-3.x

ali_b’s picture

hm, 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).

somatics’s picture

I'm getting floods of exactly the same error as #4 (down to the line# 615) on my site.

johnv’s picture

Status: Fixed » Needs work

Same error as #4 occurs, with -dev version from 29-05-2012.

IMO it needs an extra check:
if (isset($this->aliases['entity_type']) && ...

jddeli’s picture

Same error as #4

damiankloip’s picture

Status: Needs work » Needs review
FileSize
981 bytes

I think @johnv is right. Unfortunately isset() can't check the existence of both at the same time.

akoepke’s picture

This is still generating errors when I test it. It looks like these errors are because you are using || instead of &&.

if (isset($this->aliases['entity_type']) || isset($object->{$this->aliases['entity_type']})

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.

jeffschuler’s picture

The change in #9 removes the notices for me.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Yep.

patoshi’s picture

#8 + #9 solves the issue. its just a one line change with the addition of &&

screenshot http://img705.imageshack.us/img705/2301/croppercapture197.jpg

tim.plunkett’s picture

Assigned: Unassigned » dawehner
FileSize
981 bytes

Oops, missed that this wasnt a finished patch.

damiankloip’s picture

Looks good to me, apologies all for the flawed logic in #8 :)

Jawi’s picture

works for me with views 7.x-3.3+169-dev

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

This looks perfect, thanks for the effort!

Committed to 7.x-3.x and 8.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.