After update to 7-3.16 started to get this
Warning: Invalid argument supplied for foreach() in views_join->build_join() (line 1548 of ./sites/all/modules/views/includes/handlers.inc).
I need to make some patch or wait for next version?
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | views-warning_invalid-2866370-27.patch | 1.11 KB | hargobind |
Comments
Comment #2
damienmckennaCould you please install the Devel module and test to see what $this->extra is if it isn't an array?
Out of interest, does this help?
Comment #4
schwarli4783 commentedI have the same problem. In my case
$this->extrahas the valueentity_translation_node.entity_type = 'node'It seems that the problem occurs if you have installed the entity_translation module.
Comment #5
Dmitry Pogodaev commentedI'm also detected, that this accured if i use
https://www.drupal.org/project/language_fallback filter.
If i switch it off, error not shows.
And one more: if it's switched ON, i see more results then should. 1 node showing as many times as i set in view limit.
Sorry for late response. Didn't get any notification on e-mail...
Comment #6
Dmitry Pogodaev commentedI agree
It's not about language fallback, but about entity translation in views
This patch remove the warning, but content still filteterd wrong and i see in views result to much copies of 1 node
Comment #7
dotline commentedThere is also a problem when you have
https://www.drupal.org/project/views_natural_sort
installed
Comment #8
alzz commentedI have installed entity_reference module (7.x-1.0-beta6).
$this->extra as #4 says has the value "entity_translation_node.entity_type = 'node'".
Applied #2 patch and removes the warning and the view does not duplicated results for me, working good.
Comment #9
bohz commentedI also agree this is caused by the recent update in entity_translation.
Patch #2 doesn't resolve. The warning message is unvaried.
However I do not experience duplicates in my views.
Cheers
Comment #10
hartsak commentedI just noticed that my error log was also filled with the mentioned warning. In my case $this->extra seems to have at least these values:
entity_translation_node.entity_type = 'node'
entity_translation_field_collection_item.entity_type = 'field_collection_item'
I applied the patch #2 and I'm not getting those errors any more. I just have to look into my other views as well (there are so many). I didn't notice any problems with the view results, though.
Thanks for the patch!
Comment #11
loze commentedI have this error also. Not using entity_translation or views_natural_sort
Comment #12
perarg commentedThis patch works for me. Thank you
Comment #13
steveganz commentedThis patch removes the warning but we are not using entity_translation or views_natural_sort
Comment #14
rudi teschner commented#2 is not working for me. Even though it prevents the error messages, the view results contain duplicates (the entity translation filter is not applied, so all translations are shown).
From a logical point of view, the patch in #2 only considers arrays, so any value provided not as an array is discarded.
A slightly different approach would be to check whether extra is just a string and convert it into an array. That way, the warnings are gone and the views dont produce duplicate results (at least in my case).
Comment #15
sergei_brill commentedThe bug appeared due to this fix https://www.drupal.org/node/1930288
As I see, documentation says property extra must be an array but modules mentioned above sets extra as a string. I think it's not a bug of module views. We should create issues in appropriate modules and fix setting of a string in extra property of views_join class.
Comment #16
knalstaaf commented#14 works for us (haven't tried #2).
Comment #17
steveganz commented#14 works for us as well.
Comment #18
berenddeboer commentedAgree with #15, bad code should be fixed. I had a case in my code where I had a string instead of an array. What about we log a warning when it's a string with a clear indication on how to fix it?
Comment #19
attisan#14 works for me
Comment #20
alfthecat commented#14 seems to work for me too. Thanks for the patch!
Comment #21
nironan commented@loze - I found the same issue on select_translation too, perhaps you are using it too? I will file a patch there soon.
@sergei_brill - the website documentation still reports extra as . Should we update it too?
Comment #22
rosk0Completely agree with #15, bad code should be fixed. I had a case in my code where I had a string instead of an array.
Closing because there is nothing to fix in views itself.
Comment #23
j-leeI added the related issue Wrong query generated when several Translations relationships are used from the Entity Translation module.
Comment #24
artis commentedAnyone having this issue with views_natural_sort, there is now a patch against the 2.x release of that module that fixes it.
https://www.drupal.org/node/2866668#comment-12098172
Comment #25
drupalfan2 commentedI have the same error after updating to 7.x-3.16 .
And the views pages look very different (mixing up the nodes from the second language used on my site).
So views 3.16 can not be used at the moment.
Will there be any solution?
Comment #26
marco-sI agree with #15, bad code should be fixed. But I think #14 is a reasonable fallback. Thanks for the patch!
Comment #27
hargobindI'm in agreement about fixing bad code, but there are still plenty of people who just need their site to work with the latest version of views. So I'm submitting one more patch to this issue even though it's closed. It's based on #14, but the code has been moved inside of the
if (isset($this->extra))check. And it has also been added to theviews_join_subqueryclass.Comment #28
joey-santiago commentedHello!
Could you please help me understand why my code causes this issue?
put into a hook_views_query_alter implementation.
The reason i need this is the query is by default built in a way that creates duplicates as it is not filtering for the entity_translation type so that a translated file for ex would make a duplicate.
thanks
Comment #29
damienmckennaNo, I'll accept that it'd be useful to convert $this->extra to an array.
Comment #31
damienmckennaComment #32
hossein425 commented@sergei_brill #15
The documentation states that directly added string is acceptable in array items not as extra itself.
either a string that's directly added, or an array of items:
Comment #33
damienmckennaThe tests were broken but are now fixed, so lets see if this passes.
Comment #34
damienmckennaFYI there was also an instance where the 'extra' parameter was not defined properly in the module itself, see #2852791: Undefined index: field_example in views_handler_filter_term_node_tid->exposed_validate() for details.
Comment #35
damienmckennaThe tests pass, so this is good. Thanks everyone for helping to track down the problem!
Comment #36
damienmckennaComment #39
joseph.olstadthis fix caused a very nasty regression. See RTBC patch and details here:
#2908538: Thousands of results after update to 3.18 - Put extras in parentheses, otherwise OR conditions in extras not correctly enclosed