Closed (fixed)
Project:
Views Dynamic Fields
Version:
6.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
26 Jan 2011 at 20:52 UTC
Updated:
25 Mar 2011 at 11:21 UTC
Hi, I just started using this module (with views 6.x-2.12 and bonus pack 6.x.1.1). Looks great, but I get a
warning: in_array() [function.in-array]: Wrong datatype for second argument in views_dynamic_fields\handlers\views_handler_filter_dynamic_fields.inc on line 200
22 times (which is the number of fields in the view) and can't work out why.
I think it started when I exposed the filter, but hiding it again has not improved things.
It could well be me as I am playing with it, so I am hesitant to call it a bug, but...
Comments
Comment #1
girishmuraly commentedHmm, I can't really say whats happening here with the information you have supplied.
I would need to see your view, so try to post it if you can? Or, try to give me a few steps to reproduce the problem and I can try on my end. I would also need to know how you have setup Views Bonus Pack to use in your view.
Does the issue go away when you do not use views dynamic fields at all (i.e. remove the dynamic fields filter)? Do you get any other warnings along with this?
Comment #2
frosty29 commentedThanks for fast response.
I deleted the VDF filter, and all the messages (which i get in preview as well as the target page) of course disappeared. I readded the filter, and it worked fine at first. Then i exposed the filter (and also ticked remember selections) and it started spewing messages again.
(I also have Views Export xls & Semantic Views in use, I forgot to say.)
I will clone my view, remove semantics to simplify it, then report back.
OK - i have simplified the view. Deleted all fields of different types (node, content, taxonomy) just down to one display field - node title. Removed semantic views settings. Removed xls feed display. I delete the VDF filter and re add and get exactly the same as above (with just the one warning for the one field).
The differences in the two views are:
Working version:
'dyfield' => array(
'operator' => '=',
'value' => NULL,
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
'single' => '',
),
Warning version:
'dyfield' => array(
'operator' => '=',
'value' => NULL,
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'operator' => '',
'identifier' => 'dyfield',
'label' => 'Node: Dynamic Fields',
'optional' => 1,
'remember' => 0,
),
The "remember" flag being set or not does not seem to make any adverse effect.
Comment #3
frosty29 commentedHow embarrassing it seems to have cleared up, when I installed an new unrelated module. I had not cached views and any way I'd flushed everything until I'm blue in the face, yet it looks like something was screwy on my system. Nothing to see here. Sorry.
Comment #4
girishmuraly commentedAh, I'm glad it cleared up! Thanks for the post back. I was beginning to wonder if there were compatibility issues.
Comment #5
frosty29 commentedUnfortunately this same error has started up again when I made changes to that View.
Flush, running Update etc making no difference. This time on deployment server. Will find out what data is at that point.
Comment #6
girishmuraly commentedIts not good that it happened again, especially on the deployment server. Initially I would suggest you to use a debugger or some manual checking to isolate the bug. Since there are many moving parts (like other modules) it would be tricky until we isolate it. I would like to see if this is a bug in the code or its some special condition I have not caught. Thirdly it may just be an integration issue with the other modules. Eitherway I would like to make corrections if it could help you out.
Comment #7
frosty29 commentedI have run through it quickly.
When i first run it and there are no fields selected (empty report) $exposed_input does not exist and hence combined_value is ''. When I select an item the errors go and i see eg
Array
(
[combined] => a:0:{}
)
Thus a simple fix to remove my errors is
172 $combined_fields = unserialize($exposed_input['combined']);
+ if (!is_array($combined_fields)) $combined_fields =array();
Comment #8
girishmuraly commentedThanks. If that is the only cause for this bug then I see that it has been fixed in 6.x-1.4-beta1 implicitly due the code reformatting that I did there http://drupal.org/node/1046036. Would you mind upgrading your module and test to see if it resolves this warning please, as I can't reproduce the bug just using this module (I might need to understand your setup better).
Comment #9
jjwhitney commentedI'm getting this same error message now, but it's on line 365 in the just-released version (6.x-1.4).
If I insert "if (! $combined_fields) $combined_fields = array();" on line 337, the error goes away.
Thanks for this module, BTW. :-)
Edit: Oh, and I should mention that the errors only appear when the view first loads, and I get exactly one error message for every field that is unchecked.
Comment #10
girishmuraly commentedAh, the combined_fields array needs initializing in the remove_combined_fields() function during init(). So after line 61, please add:
Do let me know if this does not work for you. I really need to start writing tests on this module now, hmm..
Cheers
Comment #11
jjwhitney commentedThanks for getting back so quickly. Unfortunately, the fix you mentioned doesn't solve the problem I'm running into. On line 336 you have:
Right below that you have calls to pre_query_no_sort() and pre_query_sort(), which both require the $combined_fields parameter to be an array.
Comment #12
girishmuraly commentedThank you. I wrongly put the initialization in init() whereas line 336 was pulling values from exposed input which did not have a pre init() since its the first visit.
Committed - http://drupalcode.org/project/views_dynamic_fields.git/commitdiff/508931...