I have a two taxonomy term ref fields on users, and a view with the following:

- base: user
- relationship 1: first taxonomy field, multi-valued
- relationship 2: second taxo field, multi-valued
- filter 1: taxonomy on the first relationship, single-valued
- filter 2: taxonomy on the second relationship, single-valued

If I pick an option from just one filter, then everything works fine.
If I pick an option from each filter, the page load hangs.

Here's how far I've got with debugging this...

The site log has this:

Notice: Trying to get property of non-object in views_many_to_one_helper->add_table() (line 710 of /Users/joachim/Sites/rbs-drupal-p3/sites/all/modules/views/includes/handlers.inc).

This is within the views_many_to_one_helper object, in add_table(). It's trying to work with joins but it doesn't have what it needs.

I think I've traced the problem further back. In views_many_to_one_helper->ensure_my_table(), we have this logic:

        if (empty($this->handler->options['add_table']) && empty($this->handler->view->many_to_one_tables[$field])) {

For the first filter, this check passes because the many_to_one_tables array is empty.
The second time we come here, the value of $field is the same. I can't tell if that's part of the bug too, or if that's normal!

At any rate, having failed that condition, we go to the else part and the first statement there is:

          $join = $this->get_join();

which returns NULL. Again, I suspect this is a bug, but the code in get_join() appears to allow for the possibility of returning NULL so I am not sure. What I do know is that from here, we have a $join object that doesn't start out with a full set of keys, and so that is that I think causes the error message in add_table(), which is called further along.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Status: Active » Needs review
FileSize
1.58 KB

This patch seems to fix this for me:

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Yup, patch fixes the problem for me too.

Thanks! :D

dawehner’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Commited to 7.x-3.x and 6.x-3.x, should this be backported to 6.x-2.x as well?

joachim’s picture

I've not seen the problem on 6.x-2.x -- I've not looked, but I'm sure I've done multi-taxonomy filters before :)

zabelc’s picture

FileSize
9.32 KB

I'm not sure if it's exactly the same issue, but I'm seeing similar behavior with the 7.x-3.x-dev built on 2011-07-13. I've tried to apply the patch, but get a message that it's already been applied.

In my case I currently have a working Term view with the filter "Taxonomy vocabulary: Machine name (= Club Role)".

When I attempt to add a new filter "Taxonomy term: Term (<> Member)" it hangs indefinitely, and I've gotten an error in views_many_to_one_helper (which I'm having trouble duplicating). It also fails if I set the filter to "Taxonomy term: Term (= Member)". FWIW, not setting a value for that filter causes no problems.

I've attached the troubled view - with the problem block commented out (note that I'm using my own custom view style, but the error can be replicated with an unformatted list style).

MegaChriz’s picture

I noticed this problem too (the same as zabelc reported) in Views 7.x-3.0-rc3:

Notice: Trying to get property of non-object in views_many_to_one_helper->add_table() (regel 765 van /Websites/drupal/drupalsites/drupal7/sites/all/modules/contrib-standard/views/includes/handlers.inc).

MegaChriz’s picture

The error zabelc and I got is probably related to #1121926: Contextual filter "Taxonomy term: Name" - Several errors

javier1968’s picture

Version: 6.x-2.x-dev » 7.x-3.7

Hello, I have a similar issue that is flooding my log messages

Notice: Trying to get property of non-object in views_many_to_one_helper->add_table()

LOCATION http://test.lwec.org.uk/admin/structure/views/view/related_stories/previ...
REFERRER http://test.lwec.org.uk/admin/structure/views/view/related_stories/edit

The interesting thing is that the view does not exist on the site as it was deleted, still ajax seems to be hanging.

I can't edit any nodes neither.

Cheers

Leeteq’s picture