Favorite Nodes Profile Limit = 0 does not work

rares - March 28, 2009 - 00:05
Project:Favorite Nodes
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

On my setup, I use the block and views to display favorites, and want to keep them confidential for each user. To that avail, I set Favorite Nodes Profile Limit to 0. When I try to view the profile, I get
warning: Division by zero in .../includes/pager.inc on line 73.

#1

rares - March 28, 2009 - 00:19
Title:Profile display does not handle setting to display 0 favorites» Favorite Nodes Profile Limit = 0 does not work
Status:active» needs review

Looking at the code, I found in
function favorite_nodes_get($uid, $type = NULL, $limit = NULL) {
that there is no check for $limit == 0.

Perhaps pager_query should not fail when the second argument is 0, but an easy check could be added on line 499:
if ($type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {
should be
if ($limit != 0 && $type && variable_get(FAVORITE_NODES_NODE_TYPE . $type, 0)) {

#2

rares - March 28, 2009 - 00:28
AttachmentSize
favorite_nodes.module.limit_.patch 947 bytes

#3

kbahey - March 28, 2009 - 16:20
Status:needs review» fixed

#4

System Message - April 11, 2009 - 16:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.