We've been using node view permissions on our site to restrict viewing of "intranet" pages to authenticated users. Using Drupal 7.22 / PHP 5.3.23

After upgrading to 7.x-1.1 if a non-authenticated user used the search form, it results in an error. Reverting back to 7.x-1.0 fixed the problem. The errors were:

Warning: Division by zero in SearchQuery->execute() (line 460 of D:\extdocs\modules\search\search.extender.inc).

AND

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* i.score * t.count)), 0) / CAST('20' AS DECIMAL) + CAST('2' AS DECIMAL) * COALE' at line 1: SELECT n.type AS type, n.uid AS uid, i.type AS i_type, i.sid AS sid, SUM(CAST(:multiply_0 AS DECIMAL) * COALESCE(( 2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * CAST(:scale AS DECIMAL))), 0) / CAST(:total_0 AS DECIMAL) + CAST(:multiply_1 AS DECIMAL) * COALESCE(( ( * i.score * t.count)), 0) / CAST(:total_1 AS DECIMAL) + CAST(:multiply_2 AS DECIMAL) * COALESCE(( n.sticky), 0) / CAST(:total_2 AS DECIMAL) + CAST(:multiply_3 AS DECIMAL) * COALESCE(( n.promote), 0) / CAST(:total_3 AS DECIMAL) + CAST(:multiply_4 AS DECIMAL) * COALESCE(( POW(2.0, (GREATEST(n.created, n.changed) - :node_cron_last) * 6.43e-8)), 0) / CAST(:total_4 AS DECIMAL)) AS calculated_score FROM {search_index} i INNER JOIN {node} n ON n.nid = i.sid INNER JOIN {search_total} t ON i.word = t.word LEFT JOIN {node_comment_statistics} node_comment_statistics ON node_comment_statistics.nid = i.sid INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type WHERE (n.status = :db_condition_placeholder_0) AND( (i.word = :db_condition_placeholder_1) OR (i.word = :db_condition_placeholder_2) )AND (i.type = :db_condition_placeholder_3) AND ( EXISTS (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) ))AND (na.grant_view >= :db_condition_placeholder_6) AND (n.nid = na.nid) )) AND( (d.data LIKE :db_condition_placeholder_7 ESCAPE '\\') AND (d.data LIKE :db_condition_placeholder_8 ESCAPE '\\') ) GROUP BY i.type, i.sid HAVING (COUNT(*) >= :matches) ORDER BY calculated_score DESC LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => news [:db_condition_placeholder_2] => economics [:db_condition_placeholder_3] => node [:db_condition_placeholder_4] => 0 [:db_condition_placeholder_5] => all [:db_condition_placeholder_6] => 1 [:db_condition_placeholder_7] => % news % [:db_condition_placeholder_8] => % economics % [:matches] => 2 [:scale] => 0 [:multiply_0] => 10 [:multiply_1] => 1 [:multiply_2] => 2 [:multiply_3] => 3 [:node_cron_last] => 1371833344 [:multiply_4] => 4 [:total_0] => 20 [:total_1] => 20 [:total_2] => 20 [:total_3] => 20 [:total_4] => 20 ) in PagerDefault->execute() (line 79 of D:\extdocs\includes\pager.inc).

Comments

ascobie’s picture

FWIW, we're seeing the same error on our site.

CSch’s picture

Priority: Normal » Critical

Yes, I run into exactly the same error for all 3 of my Drupal sites after updating Node view permissions module to 7.x-1.1

hoter’s picture

Status: Active » Fixed

Thanks for your feedback. Please try to use 7.x-1.2 version.

hoter’s picture

Status: Fixed » Closed (fixed)
sjudd’s picture

Thanks 7.x-1.2 works!

CSch’s picture

7.x-1.2 works for me too. Thank you for your prompt reply!