Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 May 2014 at 10:25 UTC
Updated:
26 Jul 2021 at 23:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
stephenrobinson commentedon second thoughts first argument is $this->options['group'], perhaps this is where the error comes from?
Comment #2
stephenrobinson commented$this->options['group'] isnt an array???
Comment #3
stephenrobinson commented$this->value is the only array in this method so I guess this is the issue?
Comment #4
agileadamI'm seeing the same two errors on a site I just started maintaining.
Warning: array_values() expects parameter 1 to be array, string given in views_handler_filter_in_operator->op_simple() (line 369 of /home/redacted/webapps/redacted/sites/all/modules/views/handlers/views_handler_filter_in_operator.inc).Warning: Invalid argument supplied for foreach() in DatabaseCondition->compile() (line 1853 of /home/redacted/webapps/redacted/includes/database/query.inc).Comment #5
chewie commentedPlease check this patch
Comment #6
chewie commentedComment #7
rupesh_jagtap commentedIt didn't work for me. Still same warning message is popping up.
Comment #8
rupesh_jagtap commentedI have been getting below error for some pages -
I have resolved the bug, but it was not related 'Views' module, rather is was caused by my custom code.
Just sharing here, in case anybody might be benefited - I have used 'hook_views_query_alter' to alter the query of views block and passed array value to altered filter field value. But since that array value was empty for certain pages where block is displayed it showed the warning message.
To resolve the issue, I have checked if array has value with
(!empty($variable)).Comment #9
jofitzIt appears that @rupesh_jagtap had an unrelated problem so this should be returned to "Needs review"
Comment #10
jofitzI agree with @chewie that we should check whether
$this->valueis an array, but suggest we should do that as well as (rather than instead of) checking that the array is not empty.Comment #11
geek-merlinNote: While this patch fixes the warning, it's more probable than not that the real cause of this problem lies somewhere else.
You may want to get a backtrace with Printable Backtrace and post it here or even better debug why that illegal value got here in the first place.
Comment #12
lendudeI agree with @axel.rutz that this is just repressing an error that is caused by something else. We should find the real cause of the problem and fix that.
Lets keep this in the 7.x branch for now, since the most likely cause is a D7 handler doing something wrong. Unless we can trace this to something that is still around in D8, then lets move it up to D8 core queue.
Comment #13
mustanggb commentedIf we want to fix the source(s) of the error I have found one when using an exposed "User: Name" filter and entering a filter value of a non-existent user.
This is the fix I used if anyone cares to roll a patch.
modules/user/views_handler_filter_user_name.inc
Comment #14
steven jones commentedHere's a trivial re-roll of the patch in #10 for 7.x-3.21.
Comment #15
mustanggb commentedComment #16
damienmckennaComment #17
renatog commentedTested it here and MustangGB's patch on #15 really works well. I agree with #13 fixing the root cause. Good catch. So moving to RTBC. Thank you so much, everyone
Comment #19
renatog commentedMoved to the dev branch. Thank you so much, everyone. Have a great week