Warning message triggered by immediate sends

gjerdery - October 9, 2008 - 15:02
Project:Notify by Views
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

After new content is created which triggers an immediate notification, the follow warning appears multiple times:
warning: in_array() [function.in-array]: Wrong datatype for second argument in /srv/www/vhosts/lis.luther.edu/htdocs/modules/notify_by_views/notify_by_views.module on line 345.

On my system, it appears 20 times -- equal to the number of views which are not enabled in Notify by Views.

#1

matt2000 - October 9, 2008 - 16:22
Status:active» needs review

I wasn't able to replicate directly, but I think I see what's happening. I've just committed a fix. Please give it a try.

Thanks for sticking with this; I haven't had as much time as I hoped with this module, but your testing and reports are a big help.

#2

gjerdery - October 9, 2008 - 19:39

After applying the patch, I saw the same results as before. However... I changed this:

foreach (variable_get('notify_by_views_select_views', array()) AS $key => $view_name) {
          if (!$key && !$view_name) continue; //bail if this is an unselected view

to this:

foreach (variable_get('notify_by_views_select_views', array()) AS $view_name) {
          if (!$view_name) continue; //bail if this is an unselected view

(lines 223-224) and the warning goes away! I don't think this will introduce other unusual behavior.

#3

matt2000 - October 9, 2008 - 20:35

Both are rough hacks.

I checked the key because I noticed that having no views selected could introduce an element with key = 0, value=1.

I know theres a smarter way to do this; I just haven't had time to think it through yet.

#4

gjerdery - October 9, 2008 - 20:51

To address the case you mention above, would (!$key || !$view_name) be the correct test?

#5

matt2000 - October 9, 2008 - 20:56
Status:needs review» needs work

Yes, although, I still think there a more elegant way to do it.

#6

peggys mouse - October 21, 2008 - 23:41

that worked for me, thanks.

#7

matt2000 - April 28, 2009 - 18:30
Status:needs work» fixed

Using the OR check for now, as it does the job.

#8

System Message - May 12, 2009 - 18:40
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.