Download & Extend

Not setting a calculation results in "warning: Invalid argument supplied for foreach() [...] views_calc/theme.inc on line 178."

Project:Views Calc
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Clean install of Drupal 6.14, Views Calc 1.3, Views 2.6.

Set up a simple View: a list of nids, for example. Change the style to Views Calc Table, but then don't display any calculations: just hit update.

You get two error messages, each saying:

warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/drupal6/sites/all/modules/views_calc/theme.inc on line 178.

Patch attached; it just checks that the array in foreach() on line 178 is actually an array.

AttachmentSize
line178.patch3.49 KB

Comments

#1

Version:6.x-1.3» 6.x-1.x-dev
Status:active» needs review

Tested against 6.x-1.x-dev and it fixes the issue (for me).

I tend to be "special" when it comes to code problems so it would be good to have someone else review the patch :)

#2

How should I apply this patch? Does it completely replace the existing code in theme.inc?

Thanks!

Nevermind... I figured it out... First time I ran a patch... for those of you out there like me....

On Linux systems. Use wget to copy the patch to the module directory where the file you want to patch lives.
Type the following command: patch theme.inc line178.patch

Done.

#3

For the record, for documentation on applying patches http://drupal.org/node/60108 is a great resource.

#4

Priority:normal» critical

I have a view containing a simple computed field column containing float numbers -- I would like to show their sum, average, atc.

Even without selecting any fields I am getting the same error message, same line number (for the latest stable version 1.3, and also for the latest dev version).

Applied jim0203's patch and the error message disappeared... but also all the result rows have disappeared :-(

#5

I have the same issue on a live site. Not about to apply a patch but am willing to test a dev version with this patch applied.

Nevermind, reread the documentation and found the issue was arrising from the settings not being correct in under 'views calc table'.

#6

Status:needs review» fixed

These issues has been fixed as a side effect with this commit.
#823516: Improved summary view execute

The code above was not considered.

#7

Status:fixed» closed (fixed)

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

nobody click here