From a7d43f3460a97ad3c9b1cb23f7d374a4994837a3 Mon Sep 17 00:00:00 2001 From: webchick Date: Sat, 28 Apr 2012 23:11:57 -0700 Subject: Issue #1490150 by xjm, duellj, tim.plunkett: Fixed EntityFieldQuery::pager(0) generates PHP error 'divide by zero'. --- includes/entity.inc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'includes') diff --git a/includes/entity.inc b/includes/entity.inc index 5f721f1d9..ae7807794 100644 --- a/includes/entity.inc +++ b/includes/entity.inc @@ -1263,12 +1263,11 @@ class EntityFieldQuery { /** * Get the total number of results and initialize a pager for the query. * - * This query can be detected by checking for ($this->pager && $this->count), - * which allows a driver to return 0 from the count query and disable - * the pager. + * The pager can be disabled by either setting the pager limit to 0, or by + * setting this query to be a count query. */ function initializePager() { - if ($this->pager && !$this->count) { + if ($this->pager && !empty($this->pager['limit']) && !$this->count) { $page = pager_find_page($this->pager['element']); $count_query = clone $this; $this->pager['total'] = $count_query->count()->execute(); -- cgit v1.2.3