Hi!
I get this error (using views for project module):

notice: Undefined variable: get_count_optimized in /Library/WebServer/Documents/pm/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 947.
CommentFileSizeAuthor
#4 views-652812.patch1.54 KBdagmar
#2 views-652812-2.patch1.59 KBxslim
#1 views-652812.patch732 bytesxslim

Comments

xslim’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new732 bytes

Simple patch

-      if ($get_count_optimized) {
+      if (isset ($get_count_optimized) && $get_count_optimized) {
xslim’s picture

Title: get_count_optimized undefined » get_count_optimized & has_aggregate undefined in views_plugin_query_default.inc
StatusFileSize
new1.59 KB

Ok.
and I have same thing for undefined property $has_aggregate

merlinofchaos’s picture

Use empty() rather than isset(). While it will make no functional difference, isset() will return TRUE if $get_count_optimized = FALSE and obviously if at some point we want to add in code that flips the switch back, it would be awkward.

Also I think your spacing isn't conforming to coding standards.

dagmar’s picture

Issue tags: +alpha-2 blocker
StatusFileSize
new1.54 KB

I don't use project module, so I didn't test this. I have only rerolled the patch according to #3

xslim’s picture

I think better to use not
if (!empty($get_count_optimized)) {
but
if (!empty($get_count_optimized) && $get_count_optimized) {
that will check also for TRUE
?

dagmar’s picture

From: http://drupal.org/node/34341

The difference between isset() and !empty() is that unlike !empty(), isset() will return TRUE even if the variable is set to an empty string or to the integer 0. In order to decide which one to use, consider whether 0 or '' are valid and expected values for your variable

If you want to check if $get_count_optimized is numeric, you shoud use is_numeric().

xslim’s picture

oh, ok )

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

http://drupal.org/node/664410 does now work with the patch.

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Commited to 6.x-3.x -- does not apply to 7.x, needs to be ported.

dawehner’s picture

Status: Patch (to be ported) » Closed (fixed)

Thats already part of the group-by patch

dawehner’s picture

Issue tags: -alpha-2 blocker

remove tag